On Sat, Dec 20, 2008 at 11:45:38PM -0500, Brandon S. Allbery KF8NH wrote:
> On 2008 Dec 20, at 13:39, Carl Mäsak wrote:
>> Maybe this counts as a best practice, or maybe it's more of a
>> "pattern". In a recent piece of code, I found a way to exploit code
>> blocks to act like "return statements with side effects". The
>> resulting code became very clean, so I decided to blog about the way
>> it works.
>
>
> Hm, couldn't you also do that with a sub that explicitly throws a  
> "return" exception to the caller Routine?

Which is most easily expressed as:

    &somesub.leave()

or

    caller.leave()

if you want it anonymous.

But 'return' is shorter than that, and lambdas are shorter than
routine definitions, so the only reason for not using return
is if you want to define your helper block outside of the scope
in which return would work.

Larry

Reply via email to