Non-Purity of Algebraic opEquals

Nordlöw via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 18 11:05:27 PDT 2015


On Friday, 18 September 2015 at 15:40:09 UTC, Jonathan M Davis 
wrote:

> Regardless, VariantN couldn't have its opEquals explicitly 
> marked with pure, because it's a template and needs to work 
> with types that don't have a pure opEquals. But it _should_ be 
> able to be inferred as pure if the types in question have pure 
> opEquals. However, the situation with Object continues to haunt 
> us.
>
> - Jonathan M Davis

I'm currently only in need of a VariantN of value-types and 
string.

Therefore I don't understand why I should need Object.opEquals 
especially not in the case I gave above where Variant only 
contains a `long` and a `double`.

Is there an easy way to modify `VariantN` to not need 
`Object.opEquals` when `VariantN` contains only value types and 
strings?


More information about the Digitalmars-d mailing list