Why is std.algorithm.reduce impure?

Jonathan M Davis jmdavisProg at gmx.com
Wed Mar 7 10:57:22 PST 2012


On Wednesday, March 07, 2012 17:58:43 Timon Gehr wrote:
> 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.

Most definitely. A variety of things which are currently impure must become 
pure. Some things which didn't used to be pure still are, but there's still 
plenty left that need to be sorted out.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list