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

Richard O'Keefe ok@REDACTED
Mon May 23 04:33:02 CEST 2011


On 21/05/2011, at 2:30 AM, Michael Turner wrote:

> "... because THAT IS COVERED IN THE REFERENCE MANUAL WHERE THE VERY
> FIRST THING AFTER THE SECTION HEADING SHOWS A MULTICLAUSE FUN."
> 
> And (he says, ears ringing slightly) that somehow makes it OK for any other part of the documentation to be wrong,

I did not say that.
I did not say anything from which any reasonable person could infer that.
For one thing, I do not accept that the other part of the documentation
is WRONG, only that it is INCOMPLETE.
And yes, provided the reference manual is complete,
it IS ok for other documentation to be incomplete.

> even when your average learner is far more likely to encounter the erroneous passage first?

Only a very dumb and irresponsible learner would fail to check the reference manual.
Yes, you read the tutorials, you try the examples.
But when you want to know the details of something,
you read the reference manual.

IF you are competent at programming language learning.

> Thanks for the update about the proportions of time spent scanning vs. parsing. I'm under the influence of something I heard Bill Joy (then a student of Sue Graham's) say about lex and yacc back around 1980 or so. In any case, can we at least agree that the change I suggest is going to have minimal impact on parsing times?

Sure.  I don't actually _care_ about parsing times.
I care about the pain *I* would suffer if I had to read stuff written that way.
> 
> "If both the existing readable alternative and the proposed horrible one are supported, the code *has* to increase in volume, and *has* to become less maintainable."
> 
> Even if it actually reduces the number of grammar rules,

There is no reason to believe that it would do anything of the kind.

> or keeps the number the same,

There is no reason to believe that it would do anything of the kind.

> and even if it means the same amount of head-match checking we have now?

I don't know what you mean here.  I am not discussing run-time
complexity but the source code.
> 
> "You are attacking one of the features of Erlang that I have found most helpful."
> 
> I found this "feature" helpful in a way myself: from doing some Prolog programming, I had some experience with writing code in this pattern. But when I was doing Prolog programming, I had the same complaint about Prolog: dreary repetition of redundant identifiers where whitespace and indentation would (I thought) enhance readability. It took some getting used to. But I suppose I could have learned to love it if I'd done more Prolog programming.
> 
> We have an eye of the beholder problem, here, obviously.

Compared with something like Haskell, Prolog can indeed be "drearily repetitive".
But the predicate names are NOT the dreary or noticeably repetitive part.

For what it's worth, the identifiers are *NOT* redundant in Prolog.
(Amongst other things, have you forgotten the existence of assertz/1?
 Or the :- discontiguous declaration?)





More information about the erlang-questions mailing list