[erlang-questions] DRY principle and the syntax inconsistency in fun vs. vanilla functions

Raimo Niskanen <>
Thu May 19 13:56:02 CEST 2011


On Thu, May 19, 2011 at 07:47:50PM +0900, Michael Turner wrote:
> "But how interesting is whether existing code would break or not?"

Let me rephrase that:

Whether existing code would break is only interesting if your
change proposal is otherwise beneficial.

[sarcasm]
Could that also be misunderstood?
[/sarcasm]

> 
> Not very. I mean, who uses Erlang for anything important? Hardly anybody,
> right?
> 
> [/sarcasm]
> 
> "It would, as others have pointed out, also be much harder to jump into a
> module and _know_ what the clause does since the function's name can be
> pages away."
> 
> It would only be harder ("much"??) if you *chose*, in such cases, to use the
> syntax I propose to bring over from multi-clause funs. In the case you bring
> up, it might be wiser not to. And what I propose clearly allows everyone to
> continue with the present syntax. So your argument for readability in this
> case comes down to "somebody might not use this language feature wisely."
> (*facepalm*).

Exactly. If they only can use it wisely, where wisely sometimes - mostly
in schoolbook toy examples, means having to redundantly repeat a function name,
they can not use it unwisely. I regard that as positive.

Syntactical freedom is not always productive over the whole lifetime of
the code. Perl IMHO is an example of a language with too much freedom.

> 
> -michael turner
> 

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list