Default implementation of opEquals

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 7 07:04:10 PDT 2016


On Friday, October 07, 2016 13:41:00 Mark via Digitalmars-d wrote:
> I find it slightly annoying that the default opCmp throws an
> exception whereas the default opEquals doesn't, but if both of
> these functions are to be removed from Object, as Jonathan M
> Davis stipulates, then all of this is a non-issue.

It's the plan anyway. It fundamentally doesn't work to have them on Object
and be flexible with attributes, so it was decided a while ago that they
need to go. Unfortunately, not a lot has been done to get there yet, and
what has been done hasn't been merged. Fortunately, one of the major issues
is that (if I understand correctly) we really need a templatized AA
implementantion to be able to remove the functions from Object, and a fair
bit of work _has_ gone towards that, and it looks like we may have it in the
reasonably near future.

But there's still plenty to figure out out about how we go about this,
because a big part of the problem is how to do it without breaking code.
Once the groundwork has been laid, we could easily just remove the
functions, but that would break a lot of code, which we obviously don't
want. So, at some point here, all of that is going to need to be discussed
and a plan formed.

For now though, it sounds like the AA implementation is coming along, and
there is a PR to templatize opEquals so that it's at least possible to
declare opEquals without overriding the one on Object.

- Jonathan M Davis



More information about the Digitalmars-d mailing list