'John Porter' wrote:
> 
> David L. Nicol wrote:
> > "Randal L. Schwartz" wrote:
> > >
> > > I think we need a distinction between "looping" blocks and
> > > "non-looping" blocks.  And further, it still makes sense to
> > > distinguish "blocks that return values" (like subroutines and map/grep
> > > blocks) from either of those.  But I'll need further time to process
> > > your proposal to see the counterarguments now.
> >
> > In the odd parallel universe where most perl 6 flow control is handled
> > by the throwing and catching of exceptions, the next/last/redo controls
> > are macros for throwing next/last/redo exceptions.  Loop control
> > structures catch these objects and throw them again
> > if they are labeled and the label does not match a label the loop control
> > structure recognizes as its own.

...
 
> In a nutshell, there are different kinds of blocks, and their
> escape mechanisms are triggered by different keywords.
> By unifying the block types, and making the keywords work across
> all of them, I'm afraid we would lose this ability to jump up
> through the layers of scope to "the right place".

This ability to jump to "the right place" is exactly what exception handling
is for, as I understand it.  Exceptions allow us to have one kind of block
and any number of kinds of exit mechanisms. If qC(last die return) are all
excpetions, the can travel up the call stack until they find the appropriate handler.

The "traveling up the call stack" can even be optimized to a per-thread table of
what the appropriate handler is for the most commonly used types.




-- 
                          David Nicol 816.235.1187 [EMAIL PROTECTED]
           perl -e'map{sleep print$w[rand@w]}@w=<>' ~/nsmail/Inbox

Reply via email to