[e-lang] scoping rules of when-catch

Mark S. Miller markm at cs.jhu.edu
Sat Jul 29 09:46:05 EDT 2006


David Hopwood wrote:
> Mark S. Miller wrote:
>> David Hopwood wrote:
>> [...]
>>> What changes would be necessary to lambda-args to make exit constructs
>>> like 'break' and 'continue', and similar constructs for user-defined
>>> control abstractions, work correctly?
>> I think the answer must be "they can't". [...]
> 
> 'break' and 'continue' don't violate scope analyzability because each
> 'for' and 'while' loop *always* implicitly defines these names. So, when
> you see a 'break' or 'continue', you can apply the scope analysis rules
> as though explicit 'break' and 'continue' definitions had been added to
> each looping control construct, like in the example you give:

I don't understand what you're suggesting. Is it that "for" and "while" remain
keywords, to be understood specially by the parser/expander? Or are you just
trying to explain built-in expansions in terms of a simpler intermediate 
expansion, by introducing the "control" keyword you use below?


> Suppose we define a construct 'control' so that, for example,
> 
>     control myConstruct (condExpr) { bodyExpr }
> ==> __myConstruct (condExpr) fn __break, __continue { bodyExpr }

-- 
Text by me above is hereby placed in the public domain

     Cheers,
     --MarkM



More information about the e-lang mailing list