Hi –
On Wed, 11 Jul 2007, ara.t.howard wrote:
i’m with matz on this one
block.yield
reads, to me, simple as
‘doing my own thing…’
block.yield ‘control to you’
But “yield” does not mean “take control”. It means relinquish
control. That’s why it makes sense as a control-flow directive –
control, independent of any specific object-messaging, switches upon
“yield” – and not as a message being sent to an object. That object
is not supposed to relinquish control, so it doesn’t make sense to ask
it to.
And if you interpret it as more like “thread.kill” than like
“string.split” (i.e., telling the system to kill a thread, rather than
telling a string to split), then you’re telling the system to yield a
block. But the system doesn’t yield blocks; it yields (relinquishes
control) to blocks.
I suspect that if we didn’t have the ‘yield’ keyword and the process
of making a transition to having it be message-style, I don’t think
“yield” would ever show up as a suggestion for a name for this method
(though of course an astonishing number of terms show up in the
various free-for-all method-name suggestion fests
or
accum << block.yield
That still doesn’t tell me what it means for a block to yield. I
think I smiley-ly suggested:
yield >> block
earlier, but I actually think that’s much better than block.yield.
Make yield explicitly yield to a variable, if necessary, but don’t
send the message “yield” to an object that has no intention of
yielding anything, nor any intention of being yielded.
it’s especially easy if you happen to think of blocks as a specialized form
of co-routinues, which i happen to.
I do too; they’re co-routines to which control is yielded. They yield
control back, but that’s another matter
David