Al 03/02/12 00:14, En/na bearophile ha escrit:
xancorreu:

But you "only" put a "in" in
recFactorial function argument. What this mean? **Why** this is more
efficient than mine?
It wasn't meant to improve performance. "in" turns a function argument to "input only" 
(and eventually scoped too). Generally when you program in D2 it's a good practice to use immutability where 
you can and where this doesn't cause other performance or typing problems. Immutability avoids bugs, allows a 
stronger purity (and I have seen DMD is often able to compiler a little more efficient program if you use 
immutability/constants everywhere they are a good fit). So 95% of the arguments of your program are better 
tagged with "in".

Mmm. Thanks. It remembers me val in scala ;-)
I note it for  optimizations.
Bye,
bearophile

Reply via email to