Lazy evaluation of function arguments in D

Roman D. Boiko rb at d-coding.com
Sun May 20 10:17:34 PDT 2012


On Sunday, 20 May 2012 at 14:02:52 UTC, deadalnix wrote:
> Le 20/05/2012 01:03, Walter Bright a écrit :
>> http://www.reddit.com/r/programming/comments/tui75/lazy_evaluation_of_function_arguments_in_d/
>>
>
> This feature break pure/@safe/nothrow .
>
> I don't think this is a good idea to promote it right now, as 
> it WILL have to change.

What I would like is to have community agree on the topic, not 
necessarily change anything. Agreement would mean that the issues 
are either fixed, or some workaround proposed, or it is stated 
that this is impossible to have due to some other design 
decision, or not important for some reason.

For me the most important would be to understand how to implement 
functionality "evaluate expression at most once and store result 
for subsequent calls", even if this would be restricted to pure 
nothrow. And if we claim that immutabilily is the advantage of D, 
IMO, we need to be able to have lazy evaluation possible for 
immutable data structures. (AFAIK, Haskell has immutability and 
lazy evaluation by default.) But I don't know how to avoid 
synchronization for both evaluating and storing the result.


More information about the Digitalmars-d mailing list