[Nitro] Better than classinherit.rb!

TRANS transfire at gmail.com
Mon Apr 10 17:45:31 EDT 2006

On 4/10/06, zimba-tm <zimba.tm at gmail.com> wrote:
> oooh nice !
> some name propositions :* class_include* include_all* singleton_include
> It should express that you include the class with it's singleton methods.

> Now the question arises : how do you note that a module in designed tobe
> included with it's singleton-class methods ?

Hmm.. good question. Well it just doesn't seem to be the "Ruby Way" to
do so. Really I'm not sure why 'interlude'  isn't essentially
include's behavior already. I've examined the posssible backward
compatability issues it could cause and they're extremely remote; only
arising if some code is depending on a superclass class method and a
module later gets stuck in between with a class method of the same
name --not likely. But also that's exactly the behavior we want in
other cases, but have to do in special ways.

One way it could be done it is to have a psuedo-mixin like:

  module M
    is ClassInheritable

Then modify #include to see that this is a class inheritable module
and use 'interlude' behavior instead. But even though that makes sense
conceptually, it is still an obvious hack b/c ClassInheritable isn't
actually a real module, it's just a "tag" of sorts.

So I think it may just be better just to have the separate method,
that way it can be used in general and one can aways back peddle to
#include when THAT specific bahavior is needed.

So what if we just call this new method #is?


More information about the Nitro-general mailing list