[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Forward references?

seebs

5/26/2007 11:30:00 AM

In message <5bqjfiF2u1b1vU1@mid.individual.net>, Robert Klemme writes:
>First of all, your example is about nested classes and not subclasses.

I knew that. Maybe I shouldn't be on decaf.

>class Foo
> def initialize
> @bar = Bar.new self
> end
>
> class Bar
> def initialize(foo)
> @foo = foo
> end
> end
>end

Ooh.

>Another question is whether you really want nested classes or maybe
>rather classes in the same namespace. Basically I create nested classes
>if the nested class only makes sense in the context of the outer class.
> The situation is however different than in Java where all this is much
>more strict (and thus clear).

Classes in the same namespace might be a better choice. I
think I may just do that. Thinking about it, my assumption that
the nested classes only made sense in the context of an
outer class may be wrong. Since I can't see a reason to enforce that
assumption, I'll just remove it, and move them all into a namespace
together.

-s