Pure

Paolo Invernizzi paolo.invernizzi at gmail.com
Wed Jan 8 11:09:53 PST 2014


On Wednesday, 8 January 2014 at 19:04:24 UTC, John Colvin wrote:
> On Wednesday, 8 January 2014 at 18:40:46 UTC, Ola Fosheim 
> Grøstad wrote:
>> Is pure meant to be a compiler hint so that it is up to the 
>> programmer to enforce it? It is sometimes useful to maintain 
>> hidden state for lazy evaluation, that does not affect purity 
>> optimizations:
>
> pure is enforced by the compiler (bugs allowing...). However, D 
> purity has more shades to it than the black and white concept 
> that most are familiar with.
>
> I'll leave it to someone who knows better to explain it.

This one is a good introduction, or at least the best one I can 
remember:

http://klickverbot.at/blog/2012/05/purity-in-d/

Very well written, a pleasure to read.

/Paolo


More information about the Digitalmars-d-learn mailing list