[erlang-questions] conditional expressions

Richard O'Keefe ok@REDACTED
Tue Nov 18 22:52:24 CET 2008


On 18 Nov 2008, at 4:38 pm, Serge Aleynikov wrote:

> Your 'must' statement is not entirely accurate.

Was there any doubt about what I meant?
Let's try again:
    both 'andalso' and 'orelse' in Erlang have the
    following properties:
	the first operand must either return 'true' or 'false'
	or raise an exception;
	the second operand, if executed, must either return
	'true' or 'false' or raise an exception;
	the Dialyzer will complain if either operand looks
	as if it will return something other than 'false' or 'true';
    and above all:
	you CANNOT use them to get the same effect as
	Lisp's (OR - -) and (AND - -) or Python's similar
	operators, which allow a normal result from the
	second operand to be anything at all.

I have in fact complained about this, not because I particularly
want non-Boolean results from these operators, but because the
code that's inserted to check makes them non-tail-recursive.




More information about the erlang-questions mailing list