Against enforce()

Steven Schveighoffer schveiguy at yahoo.com
Fri Mar 18 05:22:47 PDT 2011


On Fri, 18 Mar 2011 03:50:17 -0400, Kagamin <spam at here.lot> wrote:

> Steven Schveighoffer Wrote:
>
>> As long as the delegate does not access shared/global data, it should be
>> able to be pure.  Even delegates which modify TLS data should be able to
>> be pure (weak-pure, but still pure).
>
> Pure functions calling weakly pure functions are also weakly pure and so  
> on. This effectively leaves you without purity.

No.  Strong-pure functions can call weak-pure functions and still can be  
strong-pure.  That's the huge benefit of weak-pure functions -- you can  
modularize pure functions without having to change everything to immutable.

-Steve


More information about the Digitalmars-d mailing list