[Vm-dev] Finally Time to Make Good on "Everything is a message send"?

Sean P. DeNigris sean at clipperadams.com
Sun Sep 17 13:51:33 UTC 2017

On the "Squeak Beginners" ML, a new Smalltalker wrote:
> I don't understand why Smalltalk doesn't allow me to have an or:
> method that takes a block argument (except on Boolean).

The answer apparently was that the compiler replaces the code with an
optimization that is usually what one wants, and the actual message never
gets sent:
>    Ralph Johnson wrote
>    Yes, when the compiler sees   exp or: [ ... ] then it assumes that
> "exp" is
>   a boolean-valued expression and generates code that fails if it isn't.

I remember the pain of tripping over these little "everything is a message
send to an object*" sins as a new Smalltalker. I wonder now, with the
incredible speed of Cog, Spur, Sista, etc., if these devil's bargains from
prior decades are still necessary. It would be psychologically satisfying
(and nice for newbies) to remove the asterisk from the principle above.

p.s. IIRC e.g. Opal has flags to modify this behavior, but could the actual
messages be sent by default, and the flag be set to inline when that
performance boost is actually required?

Sent from: http://forum.world.st/Squeak-VM-f104410.html

More information about the Vm-dev mailing list