This could still be simpler without losing anything: It's kind of redundant to use ";" at the end of rules that are followed by another rule for the same function. Erlang could just use "." here as well. The parser could still tell that another rule for the same function follows by seeing if another rule for the same function follows ;-)
(Prolog, which influenced this part of Erlang syntax an many others, does it this simpler way. It still sucks if you want to comment out the last line of a clause, or switch the last line of a clause with some other line.)
In Prolog, there is a neat technique that lets you "comment out" any goal of a clause, including the last one, in a completely uniform way.
The trick is to define * as a prefix operator, and then define the predicate ( * )/1 to generalize away its argument. You only need two lines to do it:
:- op(920,fy, *).
*_.
Now, you can put * in front of any goal to "remove" it. For example:
pred :-
true,
* false.
With this definition, ?- pred. succeeds.
In Erlang, you cannot easily replicate this. You can try parse transformations to rewrite code at compilation time:
(Prolog, which influenced this part of Erlang syntax an many others, does it this simpler way. It still sucks if you want to comment out the last line of a clause, or switch the last line of a clause with some other line.)