[Newbies] Where is the setter for self?
Ben Coman
btc at openInWorld.com
Sat Jun 2 07:29:20 UTC 2012
Chris Cunnington wrote:
> http://www.osrcon.ca/image2.png
> http://www.osrcon.ca/image1.png
>
> Yea, I'm not asking this very well. And all things Renggli make my
> head spin.
>
> In image2, if I inspect the string 'bob' I see self contains a string
> called 'bob'. It does not say "a ByteString", which to me means the
> usual behaviour has been overtaken by something else. We don't get an
> instance; we get only its return value. The instance "a ByteString"
> was no longer as important as its return value.
>
> In image1, Lukas has overwritten Object>>printString: in
> SUObject>>printString:. And he's using a pattern ("composite with
> decorations" or something) to represent the domain of the JavaScript
> language in Smalltalk.
>
> If I print "SUSlider new" I don't get "a SUSlider". I get a string of
> JavaScript. What is printed out is what is found in self. If I inspect
> "SUSlider new" I can see in self the string that will be produced. I
> can also see in the decoration instance variable "a SUCreate". With
> each decoration in the chain he makes the string in self gets longer.
> If I execute that entire piece of code from "SUSlider new" down to
> "onChange:" I will get a string of pure JavaScript.
>
> If how I'm asking this is still really confusing, I'll have to sit on
> it for a few days. I seem to do my best comprehending when I'm asleep.
>
> Thanks,
> Chris
>
You may already understand the cascade of message sends, or it may be
confounding your understanding. That is, if you are incrementally
inspecting from "X := SUSlider new" up to each next semi-colon and
seeing each Inspector pointing at a different object, since "new" is
executed each time. Just to round out your understanding of self try
"Do It" separately on each the following lines...
x := SUSLider new new Control.Slider(null,null) inspect
x handleId: 'handle'
x trackId: track
x value: position
x range: (0 to: 100)
x onChange: ( SUUpdater new id: 'position' )
More information about the Beginners
mailing list