Erlang argument matching and performance -


any difference between these 2 performance (or other) perspective?

f1(x=whatever) -> ok; (more...)

and

f2(whatever=x) -> ok; (more...)

you can examine code compiler produces compiling -s generates .s file. you'll , can confirm compiler generates same code each of 2 cases.

{function, f1, 1, 12}. {label,11}. {func_info,{atom,test},{atom,f1},1}. {label,12}. {test,is_eq_exact,{f,11},[{x,0},{atom,whatever}]}. return. 

personally, find "whatever=x" counter-intuitive , harder read.


Comments

Popular posts from this blog

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

Java - Returning an array from a method to main -