[erlang-questions] A style question
Jayson Vantuyl
kagato@REDACTED
Sat Feb 13 22:39:15 CET 2010
I've always felt that "fun some_func/2" is underused. In the case of Mnesia, it's easy enough to do:
> mnesia:transaction( fun actual_worker_fun/0 )
I also find this to be nicer for the purposes of documentation, static analysis, debugging, and readability.
On Feb 13, 2010, at 10:55 AM, Vance Shipley wrote:
> In my personal style I only use an inline fun() when it is
> short enough to fit on one line:
>
> case mnesia:transaction(fun() -> mnesia:all_keys(funky) end) of
> {atomic, Keys} ->
> ...
> {aborted, Reason} ->
> ...
> end
>
> Otherwise seperating the transaction logic itself from the
> transaction result handling is more clear.
>
> -Vance
>
> On Fri, Feb 12, 2010 at 05:34:52PM +1300, Richard O'Keefe wrote:
> } My preferred style for this would be
> }
> } mnesia:transaction(fun () ->
> } ....
> } end)
>
> --
> -Vance
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
--
Jayson Vantuyl
kagato@REDACTED
More information about the erlang-questions
mailing list