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

Kenneth Lundin <>
Mon Jan 26 09:59:04 CET 2009


Hi,

The deadline is now passed and it is time to make a summary of the comments
and take a decision regarding EEP-25 "Unnesting cases".

A summary of the comments goes like this:
We have got comments from 10 persons and of those we have 9 yes and 1 maybe.
of the 9 yes we have 6 which does not like the reuse of the keyword
'or'. 'else' or 'default' was suggested instead.

Representing the Erlang/OTP team I also think the reuse of 'or' is
bad. If we should introduce changes or additions in the language we
should do it properly or not at all. In this case we think the reuse
of 'or' leads to a strange syntax.
We always strive for backwards compatibility where we think it is
important, but in this case I don't think it is bad to introduce
'else' as a new keyword. The new keyword will not imply major problems
since 'else' is not used very often as an atom or module or function
name.
In Erlang/OTP R12B-5 we have for example 7 modules which use the atom
'else' and it will be trivial to avoid the conflict with the new
keyword by just quoting 'else' when used in those modules.

I will do a bit more investigation on the occurrence of 'else' before
we decide but I don't expect any problems.

We will suggest that the EEP-25 is approved but with 'or' case changed
to else case. And that 'else' is a new reserved keyword from
R13.

The syntax for the unnested case should then look like:
'case' Expression 'of'
	      Pattern ['when' Guard] '->' Expression
         {';' Pattern ['when' Guard] '->' Expression}...
	{';' 'else' 'case' Expression 'of'	
	      Pattern ['when' Guard] '->' Expression
         {';' Pattern ['when' Guard] '->' Expression}...}...
	'end'

An example of the unnested case should then look like:

case equal(P, Suffix, List) of
   true     -> true;
else case List of
   [_|Tail] -> suffix_loop(P, Suffix, Tail);
   []       -> false
end.

/Regards Kenneth Erlang/OTP Ericsson



More information about the eeps mailing list