On 22 December 2010 00:24, Charles Monteiro <charles@nycsmalltalk.org> wrote:
Igor:
Let me preface that I pay my bills doing VisualWorks by day and we have namespaces.
Yeah, I'm not sold on them but several languages have them and so I wondered what I was missing. In a way if you could use them to constraint the instantiation of a nested class to only occur within a outer class it may have some merit i.e. an arm can only exist in the context of a body etc, but how value does it add ? From my perspective traits adds value and its worth its cognitive overhead, not sold on nested classes.
me neither
"you can just do: Body Leg new.
and in Body>>#Leg answer any class you want to play role as 'Leg'.
Or you missing double colons in the middle? :) "
I missed something here ? , in Ruby the syntax is:
Body::Leg.new
sorry, i was imprecise. I meant to say 'do you miss the colons?'.. (sarcasm) :)
I guess you are saying that in Smalltalk I can just setup the accessors to return whatever plays the role of a Leg but part of the point is that the Leg class is defined within a Body class and I guess if you are looking a source file in Ruby that might be helpful :)
i.e.
class Body
  class Leg
    def method1
    end
 end
end
The fact that Ruby and other language developers are not used to browser categories maybe makes this helpful in some way.
I don't think so. You can't create a class in smalltalk without assigning a category to it, so, a developer, who just started with smalltalk, are forced to use categories anyways. Yes, and the fact that nested classes systax like in Ruby or other languages are possible, because they using a 'source files' , which is single bloat of code. While in smalltalk, you usually operating with single method at one moment of time, and all browser operations and UI are optimized around that simple idea, so you don't need to scroll endless file with source code to find the method or nested class you are looking for at line #10974.
-- View this message in context: http://forum.world.st/Nested-classes-tp3125667p3159885.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
-- Best regards, Igor Stasenko AKA sig.