Blocks (Re: Fear and loathing of the "perification" of
Smalltalk)
Marcel Weiher
marcel at metaobject.com
Mon Sep 17 16:29:37 UTC 2007
On Sep 17, 2007, at 2:35 AM, Colin Putney wrote:
>> A block is just an unattached/anonymous method body and a method
>> just a block with a name that's attached to a class. However,
>> with that unified view it becomes immediately obvious that there is
>> something wrong with blocks. After all, we don't directly call
>> methods in other cases, that's early binding and a Bad Thing.
>> Instead we send messages to objects. How does not naming the
>> method body make this type of early binding and leaking
>> implementation better?
>
> That's not quite true. In Smalltalk, blocks *are* objects,
They "are" objects only in a very trivial way, just as much and as
little as method bodies.
> and it's not possible to directly "call" a block. Instead, you send
> the message #value to it.
That's just another implementation detail. Notice how #value does not
carry the intension of what you are trying to do, it is a completely
generic message. Your intension is not encoded in the message, it is
supplied solely by the implementation ( = method body ) you've
provided in the block itself.
Marcel
More information about the Squeak-dev
mailing list
|