Expanding the horizons of D purity

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Nov 1 10:26:07 PDT 2013


On Thu, Oct 31, 2013 at 10:10:03PM +0100, Timon Gehr wrote:
> On 10/31/2013 09:05 PM, H. S. Teoh wrote:
[...]
> >So, in a nutshell, my proposal is:
> >
> >- Functions that, besides invoking a delegate parameter, are pure,
> >   should be allowed to be marked as pure.
> >
> >- Template functions that, besides invoking a delegate parameter,
> >   perform no impure operations should be inferred as pure.
> >
> >- A function that takes a delegate parameter cannot be strongly pure
> >   (but can be weakly pure), unless the delegate itself is pure.
> 
> Should probably be 'pure immutable', as lined out above. Do you agree?
[...]

Yes, you're right. If the delegate can't modify anything externally,
then the function can be made strongly pure.


T

-- 
One reason that few people are aware there are programs running the internet is that they never crash in any significant way: the free software underlying the internet is reliable to the point of invisibility. -- Glyn Moody, from the article "Giving it all away"


More information about the Digitalmars-d mailing list