[dmd-beta] beta 2

Jonathan M Davis jmdavisProg at gmx.com
Wed Jul 6 12:50:08 PDT 2011


On 2011-07-06 12:46, Walter Bright wrote:
> On 7/6/2011 12:08 PM, David Simcha wrote:
> > Again, where does this leave the weakly pure function issue?  I want to
> > be sure that weak purity for non-const member functions is going away
> > forever before I take it out of all my code and test this beta in any
> > detail.
> 
> The trouble was that there were a lot of functions marked as 'pure' that
> were changing things pointed to by its arguments.
> 
> I understand that within a pure function, such a pure function could modify
> locals without the caller becoming impure. But those functions are still
> impure.

But they're supposed to be weakly pure, because they don't alter an global or 
static variables. They're _supposed_ to be able to alter stuff which is passed 
to them. They're just weakly pure instead of strongly pure and thus can't be 
optimized out. Then strongly pure functions can call them and retain all of 
their guarantees. It sounds like you're throwing out the whole idea of weak 
purity. Certainly, as it stands, weak purity is pretty thoroughly trashed if 
not outright gone.

- Jonathan M Davis


More information about the dmd-beta mailing list