[e-lang] scoping rules of when-catch
Mark Miller
erights at gmail.com
Wed May 31 17:26:35 EDT 2006
On 5/31/06, Marc Stiegler <marcs at skyhunter.com> wrote:
> While I am a fan of the easy-when, I really want to introduce the
> when-catch first in Walnut, and use it almost exclusively until late in
> the book. It is important, I believe, to get people into the habit of
> thinking about the exceptional case when they are communicating over the
> wire. As we have discussed often, the chances of getting a failure when
> you are going over the wire are much greater than the chances of failure
> when you are just moving from one executed statement to the next.
>
> You are not thinking of removing when-catch, correct? Just adding
> easy-when, right?
There are two aspects of the official when-catch syntax that the
easy-when switch makes optional: The done-function header and the
catch-clause. Approximately:
<whenExpr> ::= when (<expr>*) -> <funcHeader>? { <expr> } <catchClause>?
<funcHeader> ::= <ident> ( <pattern>* ) <optGuard>
<catchClause> ::= catch <pattern> { <expr> }
Without enabling the easy-when switch, the <funcHeader> and the
<catchClause> are mandatory, i.e., the meta-syntactic "?"s in the
first production above go away.
I just talked to MarcS and clarified that his concern was to ensure
that the <catchClause> would still be allowed, as indeed it can.
However, I am thinking about deprecating and eventually removing the
<funcHeader>. It no longer seems to me that it provides enough value
to justify its weight. Does anyone see any compelling reason to
continue to allow the <funcHeader>?
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
More information about the e-lang
mailing list