[Newbies] tutorial: "doesNotUnderstand" instance variable
Andrew n marshall
Andrew.n.marshall at mail.com
Wed Nov 14 15:38:42 UTC 2007
Cédrick Béler wrote:
> The error message says that #existSides: doesn't exist. So either you
> create it (the accessor) or you directly affect the instance variable.
> BlankCell>>existSide: aDictionary
> existSide := aDictionary
> or you replace in you initialize method "self exitSides: Dictionary"
> new by:
> existSide := Dictionary new
Where are you getting "existSides"? Everything I see in the stack
screen shot and in my email says "exitSides"?
I'm going to assume that was a mistake, and you're suggesting the same
thing Karl mentioned.
If I do this, it "doesNotUnderstand" the following line. But I see the
var is set, so I remove self from all the following lines. The accessor
complains similarly, and I remove self from it also.
It works, but I'm confused and concerned now. Why does the tutorial (
http://squeak.preeminent.org/tut2007/html/021.html ) recommend the other
form, and why does that form work for activeSegments (my other instance
variable, which is also a Dictionary) but not exitSides:
self activeSegments: Dictionary new.
self activeSegments at: #north put: false.
self activeSegments at: #east put: false.
self activeSegments at: #south put: false.
self activeSegments at: #west put: false.
In my mind, I now have two instance variables of Dictionarys that I have
to initialize and reference in different ways.
I just realized activeSegments has an accessor / mutator pair. So, is
this an omission of the tutorial, forgetting to mention the those
methods? Am I correct in concluding methods calls are always prefixed
by the class instance variable name (in this case "self) while instance
variables of self are referenced directly?
More information about the Beginners