[erlang-questions] guard expression restriction

Ulf Wiger ulf.wiger@REDACTED
Thu Dec 2 10:34:27 CET 2010


On 2 Dec 2010, at 09:37, Kostis Sagonas wrote:
> 
> Yes, Erlang is Turing complete as it is (so you can express in it any algorithm you want to) and of course there is that transformation, but do you really claim that the bulky code with the case statement and having to factor the rest of f into a separate function is more expressive and programmer-friendly than the one liner with the guard? Sorry, but I do not see this.

I interpreted Richard's point as being that it's a rather simple matter
to write your program with user-defined tests that are not guards,
even today. I don't think it is as elegant, but it doesn't blow up in your
face either.

I wrote in a previous mail that tackling abstract patterns, higher-order
patterns, and parameterised receive (possibly in one single approach)
would have a more revolutionary effect on Erlang programming than 
user-defined guards, as it would make it possible to do things that are 
very hard or awkward to do today.

Allowing user-defined guards is IMHO probably a good thing, but 
will serve to make programs just a little bit more concise than today.

And as you, Kostis, have pointed out, it is still non-trivial. Hopefully 
some of that work will also help attack what I see as the more 
interesting issues.

BR,
Ulf W

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com





More information about the erlang-questions mailing list