Where the implicit self is in St80 [was: Fear and loathing of the "perlification" of Smalltalk]

Jason Johnson jason.johnson.081 at gmail.com
Thu Sep 6 15:44:54 UTC 2007


On 9/6/07, Klaus D. Witzel <klaus.witzel at cobss.com> wrote:
> Hi Jason,
>
> But it has! :) Smalltalk has implicit self, to some extent. Consider that
> Smalltalk and Self are at the same language level. Then, whenever you use
> nil, true, false, a temp/arg, an iVar or a class/pool/global var, you send
> that implicitly to self, in both languages :)

To self?  If you mean self as in the receiver of the message (which is
what I mean), then I disagree.  In Smalltalk, when the compiler sees a
use or an assignment of an iVar then he generates a push opcode that
accesses the current receiver, but that's not a message send, that's a
low level memory access.  temp/arg variables are located in the
context object, not the receiver.  And nil, true and false are
singleton objects.  I don't see what you mean with this at all.

> In Smalltalk it's the compiler who knows what the receiver(s) of these
> implicit self messages are, it [the compiler :) ] quickly calculates the
> intended binding and emits a corresponding bytecode, optimizing away the
> costly message send.
>
> Can you see it? :)
>
> In Self the initial non-optimizing compiler doesn't know that quick
> binding. But the Self runtime optimizing compiler comes to the very same
> result (binding) as Smalltalk's compiler.
>
> It's a matter of view on things :) It'd be easy in Smalltalk to always
> send (self nil), (self true), (self iVar), etc :)

Sorry, I don't understand this at all.  This may be a way of looking
at it, but I don't see it in the language, nor the blue book
specifications.



More information about the Squeak-dev mailing list