[eeps] Request for comments on EEP-25 "Unnesting cases"

Richard O'Keefe <>
Mon Dec 22 04:42:22 CET 2008


On 20 Dec 2008, at 1:47 pm, Dave Smith wrote:

> I'd favour omitting the "or" and I would tend to format it like  
> this...
>
> case Expr of
>     Pat -> Expr ;
> case Expr of
>     Pat -> Expr ;
>     Pat -> Expr
> end.

It is too easy to read this as one case followed by another
at the same level.  In fact this suggestion is ALREADY in the
EEP and is dismissed as error-prone.
>
>
> After all the case's are piers and belong at the same indent level.  
> If we do go with an "or", isn't the ";" redundant?

No, because E or case ... is already syntactically legal and
means something else.  I've been through all this.  Finding
something that
(a) doesn't already mean something in Haskell,
(b) doesn't add any new keywords, and
(c) looks good
is very hard.


> Semantically, I've always considered ";" to mean "or" and "," to  
> mean "and" in Erlang.
>
> I can appreciate Richard's "unique" formatting style. Unfortunately,  
> optional preceding ";" is not allowed on the first  pattern.

That's the subject of another EEP, isn't it?
Yep, "Title: Optional leading semicolons for choices".
Had a reference implementation, too.

>
> case Expr of
>    ; Pat -> Expr
> or case Expr of
>    ; Pat -> Expr
>    ; Pat -> Expr
> end.

No, this won't do because "Expr or case" is already legal syntax.
That's why the semicolon *has* to be there.

I think that any alternative that doesn't require a semicolon
will need a new keyword.

I'll be on holiday from tomorrow,
so Merry Christmas and Happy New Year everyone.




More information about the eeps mailing list