Purity (D2 standard libraries / object.d)

Jason House jason.james.house at gmail.com
Fri Jan 9 14:37:33 PST 2009


Walter Bright Wrote:

> Jason House wrote:
> > When considering the standard library changes, I realized that
> > object.d could change. I believe a pure opCmp or toString could break
> > user code with impure versions of those functions. Would that kind of
> > a change to object.d cause any real problems for D2 users?
> 
> As Andrei pointed out, the trouble with making the Object functions pure 
> is if you want to do an override that caches its value.

One could easily generalize that to mean non-final virtual functions should never be pure. Memoizaton is a pretty basic need. I thought that was in D's future. Is that not true?



More information about the Digitalmars-d mailing list