Why is std.algorithm.reduce impure?

Timon Gehr timon.gehr at gmx.ch
Wed Mar 7 08:58:43 PST 2012


On 03/07/2012 05:29 PM, Simen Kjærås wrote:
> On Wed, 07 Mar 2012 01:41:22 +0100, Jonathan M Davis
> <jmdavisProg at gmx.com> wrote:
>
>> It really takes very little for something to be impure, and optimizations
>> often do it, because they end up using low-level constructs which
>> aren't pure
>> - some of which could be but aren't and others which probably can't be.
>
> Just so this is clear - no optimization of the compiler is going to change
> the purity of a function. An optimization on the part of the programmer
> (like using appender) might, though.

Appender must become pure.


More information about the Digitalmars-d-learn mailing list