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

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -