[dmd-beta] beta 2

David Nadlinger code at klickverbot.at
Wed Jul 6 12:57:58 PDT 2011


On 7/6/11 9:46 PM, Walter Bright wrote:
> 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.

Isn't this the whole idea behind weak purity, which we introduced in 
2.050? Weakly pure functions are supposed to be able to modify their 
arguments, yet are still tagged with the »pure« attribute and thus 
callable from (possibly strongly) pure functions.

Whether the implicit this parameter is part of the arguments through 
which external state can be read/modified is a separate another question 
(though I would argue in favor of it, since otherwise objects resp. 
member functions become unnecessarily crippled inside pure functions), 
but right now it seems like you are throwing the whole concept of »weak 
purity«, i.e. the »relaxed« purity rules out of the window. Or did I get 
you wrong?

David


More information about the dmd-beta mailing list