[dmd-beta] Preparing for dmd 2.066 beta

H. S. Teoh via dmd-beta dmd-beta at puremagic.com
Thu Jun 26 16:45:21 PDT 2014


On Thu, Jun 26, 2014 at 03:29:03PM -0700, Walter Bright via dmd-beta wrote:
> It's time we prepared another release. Currently, we've got 11 regressions
> to be addressed:
> 
> https://issues.dlang.org/buglist.cgi?bug_severity=regression&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&list_id=47252&query_format=advanced
> 
> Not bad, but let's get 'em done.
[...]

Regarding https://issues.dlang.org/show_bug.cgi?id=12255 :

I'm not sure why PR 3054 was merged, but it has some serious issues.
First, it didn't make any sense to me to require opCmp, because AA's in
D are unordered, so all that matters for something to be used as an AA
key should be (1) it has a hash value, (2) two keys can be compared for
*equality*. Requiring opCmp for AA keys just seem totally backwards to
me. It imposes the requirement for keys to be (linearly!) orderable, but
some AA keys need not be.

Now, I realize that the reason probably has something to do with the
fact that the AA implementation used to call Typeinfo.compare() to
compare AA keys, instead of Typeinfo.equals() as it ought to. But that
has since been fixed. So the compiler really should be changed to
require opEquals instead of opCmp, just as Steven said in the comments
to issue 12255.

Second, PR 3054 was broken in other ways, namely issue 12905 (which
wasn't marked as a regression, but IMO it should be).

Since we have to deal with this for the next release, let's pretty
please do it right this time:

(1) AA keys should either have neither opEquals nor toHash, or they
should have both (the onus is on the user to make sure they are
consistent with each other).

(2) We should review the compiler-generated default opEquals / toHash to
make sure they make sense, and are consistent with each other. (I
remember seeing code in object.d where some TypeInfo's have broken
compare/equals implementations.)

(3) Issue 12905 needs to be fixed before this release (IOW the broken
parts of PR 3054 should be reverted).


T

-- 
What do you mean the Internet isn't filled with subliminal messages? What about all those buttons marked "submit"??


More information about the dmd-beta mailing list