>>>>> "Ariel" == Ariel Scolnicov <[EMAIL PROTECTED]> writes:

>> yield EXPR - stop what I am doing now and give something else a
>> a chance to do its things. And while you are doing
>> that please take this EXPR from me.

Ariel> When you put it this way, isn't C<yield> spelled C<return> in Perl5?
Ariel> (Except, of course, that C<return> inside a C<grep> does a whole lot
Ariel> more nowadays).

Yes, I'd be in favor of making return() in a valued block (as opposed
to a looping block) abort the block early and return the value.  I
don't think I'd want to change last() to do that, since last() already
has an optional parameter (the loop label).  That makes the valued
block of a do {} or a grep or map be able to abort with a particular
value.  Although it would break any use of return in those blocks to
abort the enclosing subroutine, and there wouldn't be any clean
translation available.  Ugh.  Maybe we do need a new keyword. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to