SV: [erlang-questions] A style question
Mon Feb 15 00:48:25 CET 2010
On Feb 12, 2010, at 7:05 PM, Ulf Wiger wrote:
> There is an alternative that actually has a distinct advantage:
> fun my_transaction_fun/0)
> The advantage is that when tracing, you get much more readable output.
I see. There is a big disadvantage that nothing actually stops
my_transaction_fun/0 being called when it is *not* in a transaction.
The great thing about
mnesia:transaction(fun () ->
mnesia:activity(transaction, fun () ->
is that the ... code is visibly and necessarily inside a transaction.
I wonder whether there could be a way to get the best of both worlds?
I take your point about tracing, but is there any reason why a
function name displayed in tracing _has_ to be a real function
name? Could there be some way of attaching a name to a fun for
tracing purposes? Maybe something like
mnesia:activity(transaction, fun:my_transaction () ->
This is not, and isn't intended to become, and EEP.
There's probably a much better way to do it.
More information about the erlang-questions