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

Michael Turner <>
Wed May 18 18:50:33 CEST 2011


I wish I could be nice here, but ... under provocation from another critic,
forgive me for summing this up as just another strawman argument.  In
particular, claiming what I propose is all about writeability, when I've
actually already made an argument from readability (in the eye of the
beholder, perhaps). Furthermore claiming that what I propose will increase
"inconsistency", when at worst what it would increase would be stylistic
variation -- about which people argue pointlessly anyway, so where's the
loss?

There have a been two sensible counter-arguments here, both of them in the
class "the existing tools wouldn't know about this move toward syntactic
consistency." My answer to both is the same: yes, good point, but -- tools
aren't carved in stone either.

I'm still waiting for the answer to the real showstopper question: would any
existing code break, under my proposal?

-michael turner

On Thu, May 19, 2011 at 1:40 AM, Mihai Balea <> wrote:

> On May 18, 2011, at 12:13 PM, Michael Turner wrote:
>
> > "Because I can't use M-x show-matching-lines to find the heads."
> >
> > That would be "less browsable", rather than "less readable". That's a
> reasonable objection, and in fact the only truly concrete objection I've
> seen.  (If I may lump it together with "it breaks ctags", mentioned early,
> which is undoubtedly also true.)
>
> Here's another argument: after I spend 8 hours looking at code, I find that
> having the function name attached to each clause makes it easier to
> recognize where clauses begin and end.  I wouldn't worry about typing a few
> extra characters.  I find that I spend an order or magnitude more time
> reading code and thinking about it than typing it out. Maybe you are
> different and you are actually constrained by typing speed, but I doubt it.
> I care about readability and having function names in each clause makes
> things more readable for me.
>
> > Finally, nobody would be making you do this to your own code, and where
> you had to deal with it in others, relatively trivial refactoring tools
> would make it possible to "toggle" code back and forth between the two
> allowed forms.
>
>
> So basically you'd take a small source of inconsistency (because multiple
> clause funs aren't that common in the wild) and turn it into a huge one.
>
> Isn't it bad enough that people are allowed to choose their own indentation
> style? (I kid, I kid... /ducks)
>
> Mihai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110519/6a7a80dd/attachment.html>


More information about the erlang-questions mailing list