[self-interest] Another naive question

Uladzimir Liashkevich uml at atwss.com
Thu Aug 22 12:03:27 UTC 2002

Viktor wrote:
> If an object with code (method or block) is assigned into read/write (data)
> slot, then readed from the the slot, it is simply returned, not evaluated,
> isn't it?

Normally, you cannot create a literal method object and access it. Self
automatically evaluates a method when it sees brackets ( ... ). The only
exception is the method slot initialization construction (| method = (
^self ) |). But when you try to access method slot it is evaluated and
the result of the method invocation is returned.

Blocks behave differently, they are always evaluated manually by sending
one of the 'value', 'value:', ... messages to a block object.

Though you are still able to access method objects programmatically. You
need to use mirrors for that.



More information about the Self-interest mailing list