help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] seaside problem of understanding


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] seaside problem of understanding
Date: Wed, 10 Jun 2009 19:37:23 +0200
User-agent: Thunderbird 2.0.0.17 (X11/20081009)

       menuComponent [ ^menuComponent ]
       menuComponent: aMenu [ menuComponent := aMenu ]

       initialize [
           super initialize.
           self
               menuComponent: self initializeMenuComponent;
               listComponent: StListComponent new.
       ]

       initializeMenuComponent [
           | bla |
           bla := StMenuComponent new.
           bla addEntry: 'All1' withAction: [].
           bla addEntry: 'All2' withAction: [].
           self menuComponent: bla.
       ]

I am a Smalltalk newbie, but it looks like you are making a recursive call.

Yes, but not the way you thought. :-) And you set me on the right path, so thanks!

The last line should just "^bla". Now it's returning self, so menuComponent is initialized to self. That's recursive indeed.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]