Roelof Wobben wrote:
This only creates the instance variable. I'm not clear whether are saying you performed the step shown in the second last snapshot on page 16 or not - but the evidence of the MNU would seem it didn't happen. Now I'm going to extrapolate a lot a check whether you are thinking of 'activeSegments' in #initializeActiveSegments as a reference to the instance variable. However it is not a reference to the variable (even if the name is the same) but actually a send of the #activeSegments message to 'self'. Doing it like this rather than accessing the variable directly has the advantage of focusing access to the variable through a single point, which helps observability of variable access. Also, in a "live" environment like Smalltalk, when you have instances of class X in a running system, and you add an instance variable to X, all existing classes contain 'nil' for that added variable and _everywhere_ you directly access that variable in your code would need to be wrapped in a conditional.message like #ifNil: cheers -ben |
- Re: [Pharo-users] lasergame question Roelof Wobben
- Re: [Pharo-users] lasergame question Camille Teruel
- Re: [Pharo-users] lasergame question Nicolai Hess
- Re: [Pharo-users] lasergame question Roelof Wobben
- Re: [Pharo-users] lasergame question Camille Teruel
- Re: [Pharo-users] lasergame question Ben Coman
- Re: [Pharo-users] lasergame question Roelof Wobben
- Re: [Pharo-users] lasergame question Mark Rizun
- Re: [Pharo-users] lasergame question Roelof Wobben
- Re: [Pharo-users] lasergame question Ben Coman
- Re: [Pharo-users] lasergame question Ben Coman
- Re: [Pharo-users] lasergame question Ben Coman