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

Richard O'Keefe ok@REDACTED
Fri May 20 10:40:38 CEST 2011


On 19/05/2011, at 5:03 AM, Jack Moffitt wrote:

>> I'm still waiting for the answer to the real showstopper question: would any
>> existing code break, under my proposal?
> 
> Assuming the answer is no, then I think it's fine to fix the
> inconsistency an add this alternate notation.

No, it's not fine.

It fixes the WRONG END of the inconsistency.
It's like saying "Ooh, these people have two legs and those
people have one leg, the easiest thing to do is to cut one
leg off those who have too."

It harms readability in the eyes of a lot of people.

Like I said, you would have to pay me big money to read
code written in that style.

It certainly breaks *my* pretty-printer and editor.

Michael Turner is at perfect liberty to add any feature he
likes to his copy of Erlang.  He is at liberty to offer it
to other people.

> I'll also point out that this is name-less clause syntax is the same
> as in Clojure:
> 
> (defn
>  mymax
>  ([x] x)
>  ([x y] (if (> x y) x y))
>  ([x y & more]
>   (reduce mymax (mymax x y) more)))

And why do you think I don't use Clojure?





More information about the erlang-questions mailing list