[erlang-questions] A style question
Richard O'Keefe
OK@REDACTED
Fri Feb 12 05:51:46 CET 2010
On Feb 12, 2010, at 5:39 PM, Michael Richter wrote:
> Only thing I can think of is that if the same fun is used in more
> than one place in the function (or has potential to be) it's better
> to have the label. Aside from that I've got nothing.
No, that doesn't apply. In each case, the function name F is used
once and only once.
In that case, I think that instead of doing
F = fun () -> ... end,
mnesia:transaction(F),
...
mnesia:transaction(F)
it would be better to do
Transaction = mnesia_transaction(fun () ->
...
end,
Transaction(),
...
Transaction()
so that there's no possibility of calling F _without_ the
transaction safely wrapped around it.
The code is supposed to come from an expert, who clearly knows
amongst other things a whole lot more about MochiWeb than I do.
I just wondered what I wasn't seeing.
More information about the erlang-questions
mailing list