[erlang-questions] A style question
Dale Harvey
dale@REDACTED
Fri Feb 12 05:46:56 CET 2010
by default the emacs erlang mode will indent the anon function from the end
of the fun() -> line
mnesia:transaction(fun() ->
... some code here ...
end),
this takes up 27 of your 80 characters, whereas F = fun() -> is only 12,
thats the main reason I stopped doing it.
On 12 February 2010 04:39, Michael Richter <ttmrichter@REDACTED> 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.
>
> On 12 February 2010 12:34, Richard O'Keefe <OK@REDACTED> wrote:
>
> > I've been looking at some Erlang code that's full of stuff like
> >
> > F = fun() -> ...
> > mnesia:transaction(F)
> >
> > My preferred style for this would be
> >
> > mnesia:transaction(fun () ->
> > ....
> > end)
> >
> > which I think a Smalltalk or Ruby programmer would also prefer.
> > But is this just prejudice on my part, or is there a reason why
> > inserting an opaque name like "F" is a good idea?
> >
> >
> >
> > ________________________________________________________________
> > erlang-questions (at) erlang.org mailing list.
> > See http://www.erlang.org/faq.html
> > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> >
> >
>
More information about the erlang-questions
mailing list