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

Steve Davis <>
Thu May 19 10:48:33 CEST 2011

Out of interest, I tried it on one of my own modules.

Your way: https://gist.github.com/980420
The highway: https://github.com/komone/qrcode/blob/master/src/base32.erl

In order to make your way less confusing, as the pattern matching entry 
points to the function were extremely un-obvious, and in the spirit of 
making it work I tried "double indent".
Double indented: https://gist.github.com/980412

For me, either way, the intention is harder to read, and/or forces me to 
focus on/put in a bunch of white space.

What do you think?

On 5/19/2011 3:32 AM, Steve Davis wrote:
> Hi Michael,
> This example is far from convincing. Have you tried this for yourself on
> any but the most trivial case, and done a genuine comparison? If you
> had, I think you would actually agree with my point that it would end up
> being less readable.
> regards,
> /s
> On 5/18/2011 11:28 PM, Michael Turner wrote:
>> Brokenness is not the only fault a system can have. As far as I can
>> tell, the worst consequence of the proposed change is that you'd start
>> seeing code that looked like this:
>> fact
>> (0) -> 1;
>> (N) -> N*fact(N-1).
>> which is transparently obvious. So the argument that the change somehow
>> makes code less readable makes no sense to me.
>> -michael turner

More information about the erlang-questions mailing list