[erlang-questions] difference between ", " and "andalso" in guards

ok@REDACTED ok@REDACTED
Tue May 20 07:34:36 CEST 2014


> Using orelse behaves differently, it doesn't treat the arguments quite so
> independently.
>
> 1> (fun () when hd([]) orelse true -> ok end)().
> ** exception error: no function clause matching
> erl_eval:'-inside-an-interpreted-fun-'()
> 2> (fun () when hd([]); true -> ok end)().
> ok
>

Is this deliberate?  It looks very like a bug.
It is hard to imagine this distinction being *useful*.

The right thing to do would have been to allow , and ; to
be nested in guards.  *Sigh*.





More information about the erlang-questions mailing list