SV: [erlang-questions] A style question

Ulf Wiger ulf.wiger@REDACTED
Fri Feb 12 07:05:52 CET 2010


There is an alternative that actually has a distinct advantage:

mnesia:activity(
    transaction,
    fun my_transaction_fun/0)

The advantage is that when tracing, you get much more readable output. A disadvantage is that you forego the pleasure of inheriting the environment.

Note also the use of mnesia:activity/2 rather than transaction/1. It has much better semantics, and is more flexible.

BR,
Ulf W

Ulf Wiger
CTO, Erlang Solutions, Ltd.

-- originalmedd. --
Ämne: [erlang-questions] A style question
Från: "Richard O'Keefe" <OK@REDACTED>
Datum: 2010.02.12 05.37

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


---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-questions mailing list