[Nitro] class_extension
transfire at gmail.com
transfire at gmail.com
Tue Mar 20 08:27:38 EDT 2007
<quote>
Dear (core) devs,
from now on, please avoid using the facets class_extension helper.
Instead use the standard Ruby base.extend(ClassMethods) idiom. I think
this is more readable.
</quote>
All the trouble I went threw to get Matz to offer us a reliable
mechanism for module singleton inheritance and your just going to dump
it? And for what? Because you think:
module Foo
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
# code
end
Is more readable than
module Foo
class_extension do
# code
end
Are you kidding me? Moreover, do you understand the technical
differences between the two? Do you realize that the first does not
extend past the first inclusion? Ie. include Foo above into Bar and
then Bar into Baz, Baz would not have the module methods --for that
you'd have to add even more crufty code.
If you don't like the name class_extension an alternate can be
considered. It may also be possible, though not nearly as efficient,
to have syntax like:
module Foo
def ext.some_method
...
T.
More information about the Nitro-general
mailing list