Expanding the horizons of D purity

deadalnix deadalnix at gmail.com
Thu Oct 31 16:26:43 PDT 2013


I think you take it the wrong way. Weak purity have some 
guarantee in itself, like you know it won't reach shared data 
unless you pass them explicitly, do not touch anything static, 
etc . . .

You are basically addressing 2 more general problems here. Both 
are real and larger than the case you are considering.

The first one is delegate purity and context type qualifier. As 
you mention, a delegate's context is simply some extra data that 
get passed to the delegate as ARGUMENT. So the delegate must be 
able to mutate this while being pure.

That is the first thing : pure delegate must be able to mutate 
their context.

The second one is the inout problem. Qualifier in output may 
reflect the one in inputs. inout solve this for some type 
qualifiers, but sometime is ambiguous and does nothing for the 
problem at large.


More information about the Digitalmars-d mailing list