[eeps] Requests for comment on EEP 26 "Make andalso and orelse tail-recursive"

Bjorn Gustavsson <>
Fri Jan 30 12:33:50 CET 2009


On Fri, Jan 30, 2009 at 12:09 PM, Robert Virding <> wrote:
> I support the EEP.
>
> What is the reason for not doing the full EEP-17? From what I could see the
> difference was in using andalso and orelse in guards.
>

The difference was that EEP-17 suggested that ';' and ',' should be allowed to
be used nested inside parenthesis, and that ';' and 'orelse' should be
equivalent.

We want ';' to remain syntatic sugar for several clauses with the same body,
that is

foo(Patterns) when P1; P2 ->
   Body.

works the same way as

foo(Patterns) when P1 ->
  Body;
foo(Patterns) when P2 ->
  Body.

If P1 causes an exception, but P2 evalutes to true, the Body will be executed,
but in

foo(Patterns) when P1 orelse P2 ->
  Body.

the Body will not be executed if P1 causes an exception.

(EEP-17 also mentioned the bad quality of the code generated for
andalso/orelse in guards,
but that that is merely an implementation detail that need not be
mentioned in an EEP.
Bad code generation can be fixed at any time, and in fact I have
already fixed that problem in the
development branch for R13.)

/Bjorn
-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the eeps mailing list