[erlang-questions] A style question

Eric Newhuis <>
Fri Feb 12 14:00:23 CET 2010


Martin Fowler would probably say that F is a temporary variable and, as such, is unwanted because it slows down refactoring.  I tend to agree with him.  This is especially true in Erlang when attempting to quickly merge code segments that secretly share a common temporary name but for different purposes.  Hilarity ensues as one reaches for search/replace.

On the other hand if there were more powerful visual debugging features then I wouldn't consistently break this sage advice by leaving temporary variables around from commented-out print statements.


On Feb 11, 2010, at 10:34 PM, Richard O'Keefe 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:
> 



More information about the erlang-questions mailing list