[erlang-questions] A style question

Richard O'Keefe ok@REDACTED
Mon Feb 15 06:54:44 CET 2010


On Feb 15, 2010, at 6:40 PM, Michael Turner wrote:

>
> Richard wrote:
>> I think we're now pretty much down to the "personal judgement"
>> level.
>
> In some ways, that's where it started.  For example, you  
> characterized F
> as "opaque".  Fair enough, but it's at least allusive in the right
> ways.

It's about as helpful as calling a number N or an atom A.
I don't know what "middle school" is, but you'll often find
f, g, h used as function names, which only leaves 23 letters
of the alphabet.  I'm pretty sure I met that at high school.
>
> So when I read
>
>    F = fun () -> ....
>    some_call (..., F, ...)
>
> the fact that it's F (and not, say, U or K) actually helps a bit.   
> After
> all, the idea of passing functions to functions remains a little weird
> after all these years.

Fortran has allowed functions to be passed to functions for over
fifty years.  In my first programming classes, using Algol, we
were shown procedures passed to procedures in about lesson 3.
(Because it was a numerical analysis class, and integration is
an N.A. topic.)

> Code like the above makes me think, "Ah, that's right, some_call takes
> a function in *that* argument position.

The function in question has only one parameter.
What's to be reminded of?  And I fail to see how "F" is a better
indication of function-ness than 'fun'.
>

> And, of course, the whole thing is easier to indent prettily.

Not with decent tools.
>
>



More information about the erlang-questions mailing list