Executing boolean expressions on a list

Thomas Lindgren <>
Mon Mar 17 23:30:50 CET 2003


--- Bjorn Gustavsson <> wrote:
> Richard Carlsson <> writes:
> 
> > On Sat, 15 Mar 2003, Pierpaolo BERNARDI wrote:
> > 
> > Well, this is what I also said when we implemented
> it, but the OTP
> > guys were not convinced, and preferred to have the
> check there. But
> > perhaps your complaints will be more influential.
> Björn, are you
> > reading this?  :-)
> > 
> 
> I not just me. When asking people in the OTP group,
> nobody liked the idea
> of not checking the right-hand side of 'andalso' and
> 'orelse'. The change would
> not be consistent with how 'and' and 'or' work.

Here is the behaviour I would expect, with A and B
being expressions. Is it anything like what is
implemented?

A andalso B =>
case A of
   true ->
      case B of
         true -> true;
         false -> false;
         Else -> exit(badarg)
      end;
   false -> false;
   Else -> exit(badarg)
end

And 'orelse' done in the same manner. 

I haven't checked what is done today, but erl_lint
should also complain about pattern matching in A or B
(at the very least B, since variables exported from B
are unsafe).

Best,
Thomas


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com



More information about the erlang-questions mailing list