[e-lang] scoping rules of when-catch

Kevin Reid kpreid at mac.com
Wed May 31 21:33:31 EDT 2006


On May 31, 2006, at 20:41, Mark Miller wrote:
> On 5/31/06, Kevin Reid <kpreid at mac.com> wrote:
>> On May 31, 2006, at 17:26, Mark Miller wrote:
>>
>>> <funcHeader> ::= <ident> ( <pattern>* ) <optGuard>
>>
>> What was the original reason for its inclusion?
>
> The main one was FQN-based upgrade. The other was that I was
> uncomfortable reasoning about the type of p in
>
>     when (p) -> { ... p ... }
>
> as being resolved within the when-closure, but unresolved outside the
> when-closure. By contrast, in
>
>     when (p) -> done(i) { ... i .... }
>
> we can think of i as having the type that p resolves to. My intuition
> was that separate types should be associated with separate variables.

Two thoughts:

- This is something the E programmer will need to know about  
independently of whether 'when' is involved.

- Nontrivial patterns are a good reason to not kill the <pattern> in  
'when':

     when (foo) -> _([bar :int, baz]) { ... bar ... baz ... }

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>




More information about the e-lang mailing list