[Vm-dev] Identifiying BlockContext returns to caller context or
home context from source
eliot.miranda at gmail.com
Mon Dec 9 20:02:34 UTC 2013
On Mon, Dec 9, 2013 at 10:40 AM, gettimothy <gettimothy at zoho.com> wrote:
> Does sending the message 'value' to a block always mean the return is to
> the caller context? or are there instances where the return is to the home
> [burp + self wonk] value.
[^burp + self wonk] value
returns to the sender (of the home context), hence the term "up-arrow
BTW, Squeak no longer has BlockContext. It has full closures; see my blog
posts on the closure compiler. The difference is not major. Essentially a
block (closure, BlockClosure) is created when the code encounters [....],
and a block activation is created when that gets sent value[:value:...].
Conversely, if there is no value message sent to the block, do I know that
> the return context is the home context (i.e. where the block was defined)
> and never to a caller context?
> boop ifTrue:[ ^self latestAnswer]
Up-arrow return is always to the sender of the home. Return to the caller
happens only if the flow of control reaches the end of the block without
encountering an up-arrow return.
> I am assuming yes, but given that my last assumption was incorrect, I
> thought I would ask.
> Just a simple yes or no is sufficient.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev