Messaging vs. subroutines

jecel at lsi.usp.br jecel at lsi.usp.br
Mon May 17 05:32:11 UTC 1999


I think it would be fair to say that Joachim examined the source code for
the Squeak VM and found the messages were IMPLEMENTED AS subroutines. That
is not the same as saying messages ARE subroutines.

To use the example by Randal L. Schwartz: if you look at the bytecodes
generated by the compiler for #whileTrue: or #ifTrue: you might conclude
that blocks ARE the same thing as blocks in Algol or Pascal. It would be
better to say that in these cases they are implemented in the same way
in Smalltalk and in Pascal (using conditional jumps), because in other
cases Smalltalk blocks are implemented in an entirely different way
(though the programmer doesn't notice this - it is an implementation
trick).

If you add a full meta-object system, like Jeff McAffer's CoDA, you
will see that subroutines are just one of many interesting implementations
for message passing. I hope to see something like that come to Squeak in
the future.

Even as it is today, if you look at things like #perform: or proxies
using "message not understood" you can see that subroutines don't fully
explain what is going on (sorry if I got these selectors wrong - I have
been programming mostly in Self, lately).

-- Jecel





More information about the Squeak-dev mailing list