[erlang-questions] Erlang elseif

Jay Nelson jay@REDACTED
Tue Nov 25 03:22:51 CET 2008


> On 22 Nov 2008, at 8:13 pm, Jay Nelson wrote:
> a lot that I agree with, but there is a sad irony:
>> If you look at this code, the concept of branching on a condition
>> is not represented.
>
> Yes it is, and it's precisely branching on a full logical expression,
> not a guard.

Conceptually for me it is a filter, rather than a branch.

>
> It really is absurd to allow full Boolean-valued expressions
> in list comprehensions but not in something like 'if'.
> I have what I think are good reasons for finding the excess
> power in list comprehensions lamentable rather than the limited
> power of 'if', but it's hard to see how anybody could justify
> the current mish-mash.
>

I would do away with the 'if'.  I almost never find myself using it.

I would, however, enthusiastically embrace the 'cond' statement
as an addition to 'case' and replacement for 'if'.

jay




More information about the erlang-questions mailing list