[eeps] Request for comments on EEP-25 "Unnesting cases"
Mon Dec 22 01:30:21 CET 2008
On 20 Dec 2008, at 7:15 am, Abhay Kumar wrote:
> If the goal is to provide a fall-through behavior that's also easy
> to read, then it would make sense to look at some of the other
> languages besides Algol 86: C, C++, Java, PHP, ... (default), Ruby
Of all those languages, the only one to have any kind of "else case"
construction is Algol 68. If you are talking about the keyword 'or',
that was not copied from Algol 68 (which used 'else' for ifs and
'elif' for 'else if'). C, C++, and Java all have the same deeply
no, make that CATASTROPHICALLY flawed, syntax for 'case', and have
nothing to offer us here.
This EEP is all about providing a SIMPLE answer to the people who
want a Fortran-like block IF. It doesn't add any actual power to
the language. It seems absurd to add a whole new keyword just for
something so slight.
Using 'else' would be a bad idea. In other languages things like
if ... then
would be nested, requiring two terminators, not "flat", requiring
one. And it is the point of this EEP to offer something "flat".
I do not see how 'els' would be "nice for spacing concerns",
but I am concerned that people would find it very hard to type.
(I know I find the absurd 'elsif' in some programming languages
nearly impossible to type. My fingers always correct it to
'elseif' or to the Algol 68 'elif'.)
> I wonder if the parser should support two 'end' statements
> as i expect that it will be one of the most common mistakes that
> someone will make. Also, will the 'or' 'else' also support a fall-
> through return for the block?
What does this mean? All it does is remove one level of syntactic
nesting; the EEP defines the semantics and it is in no way different
from other Erlang constructions. There is certainly no automatic
fall-through in any of them, and this EEP doesn't add one.
As for 'or' -vs- 'of', R and F are on different rows. You'd have to
be a d--n bad typist to make that mistake frequently. 'i' and 'o'
are not only adjacent, they are on the same row, yet we do not worry
about people typing 'if' for 'of' and vice versa.
Much ado about nothing?
More information about the eeps