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

Mihai Balea mihai@REDACTED
Wed May 18 18:40:16 CEST 2011


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


More information about the erlang-questions mailing list