where's Module#append_features ???
We all know that Class is inherited from Module in Ruby,
so we(or I in fact) would expect Module#append_features would
be available in Class' instance as well as Module's instance.
i.e.,
class C; end
C.respond_to? :append_features, true # => true
In MRI 1.8/1.9 and JRuby, the answer is `false'.
I know perhaps Class#append_features was meaningless in Ruby,
but it confuses me a lot. I start wondering if append_features
was defined in each (instance of Module)'s metaclass?
I don't know.
In Rubinius, yes, Class#append_features exists anyway.
That's what I expected.
I think JRuby tries to be very compatible with MRI, and Rubinius
favors consistency, soundness, etc. over compatibility.
I like the later.
==
I also start to think that Class < Module somehow
violates LSP. You can include module, but not class.
0 retries:
Post a Comment
Note: Only a member of this blog may post a comment.