[dmd-beta] Fighting with 2.059 and not quite winning

Jonathan M Davis jmdavisProg at gmx.com
Fri Apr 6 23:26:11 PDT 2012


On Friday, April 06, 2012 23:09:01 Walter Bright wrote:
> On 4/6/2012 9:04 PM, Jonathan M Davis wrote:
> > My _guess_ as to why toHash now requires purity is because the current AA
> > implementation relies on it as part of the transition to proper constness
> > and purity in Object and whatnot (the implementation isn't currently
> > templated, so it can't take advantage of purity inference).
> 
> The reason for purity is so that it can be used in functional programming
> paradigms. FP is becoming increasingly important, and we need to make the
> foundational bits of Phobos as pure as possible.

Yes. But with structs, it's often not as big an issue, because templates are 
used which means that the attributes are inferred. If the AA implementation 
were templated, then this probably wouldn't be an issue for structs at all. It 
would be pure if the struct's toHash were pure but would still work as impure 
if it weren't. With classes, however, it's definitely all or nothing, thanks to 
inheritance.

- Jonathan M Davis


More information about the dmd-beta mailing list