[Newbies] Where is the setter for self?
Chris Cunnington
smalltalktelevision at gmail.com
Fri Jun 1 17:18:53 UTC 2012
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
On 12-06-01 12:45 PM, Bert Freudenberg wrote:
> On 01.06.2012, at 17:42, Chris Cunnington wrote:
>
>
> It's a bit hard to make out what you are actually asking.
>
> If you implement "printOn:" in any class, then this method determines how instances are printed.
>
> "self" always refers to the receiver object of the currently executing message. It cannot be stored into.
>
> (LimitedWriteStream on: aString) creates a new stream writing to a string. It inherits "on:" from PositionableStream, which puts aString into the stream's "collection" variable.
>
> The "printOn:" method of an object gets a stream passed as its argument. It then sends messages like "nextPut: something" to the stream, which appends something to its collection.
>
> What else would you like to know?
>
> - Bert -
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
More information about the Beginners
mailing list