On Sunday, 20 May 2012 at 00:26:14 UTC, Mehrdad wrote:
http://www.reddit.com/r/programming/comments/tui75/lazy_evaluation_of_function_arguments_in_d/c4pwvyp

+1 ^

+1 too:

'f(x++)' what's the value of x after executing this function call?

If f is a function with a normal argument, the new value is x + 1, if f is a function with a lazy argument, the new value can be anything (depends on how many time the expression is evaluated).

So the lazy keyword hurts maintainability: you need an IDE which color differently the callsite to be usable, really ugly..

How about improving 'f({ return x ++ })' to either f({^x++})' (^ is return in Smalltalk) or 'f({x++})'?

Reply via email to