pureity of closures

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 27 10:28:54 PDT 2015


On Friday, 27 March 2015 at 14:29:05 UTC, Shammah Chancellor 
wrote:
> On 2015-03-23 09:45:39 +0000, Dicebot said:
>
>> I think this was not intended and is simply a side effect of 
>> limited D call graph analysis. Relaxing that limitation makes 
>> sense to me because unused impure function can be used for 
>> compile-time reflection or returned from pure function as a 
>> result (you need to ensure it does not capture pure functions 
>> as closure context in that case)
>
> Pure functions returning impure functions.  *BOOM* My brain 
> just exploded.
>
> -Shammah

As long it is exactly the same impure function for given set of 
arguments (including the context if any) it should comply it pure 
requirements, shouldn't it?


More information about the Digitalmars-d mailing list