[Nitro] Fwd: Troubles along the class-level heirarchy

TRANS transfire at gmail.com
Mon Jun 5 12:34:41 EDT 2006


Hi all! Matz responded. And it looks promising!

He asks for a good example of inheritor. Anyone know of good example
from Nitro that would be easy enough to snip and still be
understandable for a ruby-talk post?

(At the bottom I put my original message to matz).

Thanks,
T.

---------- Forwarded message ----------
From: Yukihiro Matsumoto <matz at ruby-lang.org>
Date: Jun 5, 2006 10:22 AM
Subject: Re: Troubles along the class-level heirarchy
To: transfire at gmail.com


Hi,

In message "Re: Troubles along the class-level heirarchy"
    on Fri, 2 Jun 2006 14:24:35 -0400, TRANS <transfire at gmail.com> writes:

|The problem I am now facing is that TSort doesn't wantto work with
|inheritor. I'm not sure why yet, but once again I am confronted with
|an issue related to this same problem. I have put hundreds of hours
|into the problem and have brought it up multiple time on ruby-talk.
|But alwasy I get the same old response, "Ruby doesn't need that". You
|have said so too.

The concrete example helps us to understand the situation.
Can I see the example of usage of inheritor.rb (in nitro)?
Preferably in the ruby-core (or ruby-talk) list?

|So, if that's is true, than I am at a loss and am hoping you might
|give me some guidance on how I ought to be handling this need.

The default behavior of #include cannot inherit module methods into
destination classes, just because I don't want to contaminate classes,
for example include the Math module.

But there might be a possibility for an alternative inclusion method
which inherits module level methods as well.  In that case, we have to
find the proper name for the behavior.

                                                        matz.

---- ORIGINAL MESSAGE

Hi Matz,

For a long time now I've been struggling with the limitations of
module inheritance, namely that a module's "class-level" can't be
inherited. This ability has proven crucial for some of the libs we
developed for the Nitro project (a system that uses meta-programming
extensively).

There's one lib in particular that we use called inheriter.rb. This
allows one to create a very flexible class-level variable that
inherits data along the class hierarchy. Of course to work, I had to
over come the module inheirtance issue. I did this with another lib
called classinherit.rb.

The problem I am now facing is that TSort doesn't wantto work with
inheritor. I'm not sure why yet, but once again I am confronted with
an issue related to this same problem. I have put hundreds of hours
into the problem and have brought it up multiple time on ruby-talk.
But alwasy I get the same old response, "Ruby doesn't need that". You
have said so too.

So, if that's is true, than I am at a loss and am hoping you might
give me some guidance on how I ought to be handling this need.

I have included both of the libs for you to have a look at. They
aren't very long, but they are subtle. Hope you have the time to have
a look.

Thanks,
Trans


P.S. The funny/depressing thing is that it takes about ten seconds to
can change a few lines of Ruby source (to allow classes to be
inherited like modules) and all these problems go away. Of course
maybe other problems arise from it, yet all the test cases run just
fine. So I wonder why we can't do that.



More information about the Nitro-general mailing list