On Oct 22, 2014, at 8:19 AM, Martin Nowak via dmd-beta <[email protected]> 
wrote:

> On 10/17/2014 05:41 AM, Steven Schveighoffer via dmd-beta wrote:
>> 
>> On Oct 16, 2014, at 3:42 PM, Martin Nowak via dmd-beta 
>> <[email protected]> wrote:
>> 
>>> On 10/16/2014 01:32 PM, Steven Schveighoffer via dmd-beta wrote:
>>>> I am too actually. From your earlier messages, Martin, I thought you said 
>>>> we would add it as a warning? Has that been done for 2.066.1? I didn't see 
>>>> it in my github traffic.
>>>> 
>>>> FWIW, I think a warning is sufficient, even if it only lasts a few 
>>>> versions. As long as silent behavior changes do not happen.
>>> 
>>> Well I made a pull and we eventually agreed that even a warning would do 
>>> more harm than good, because one cannot explicitly use the compiler 
>>> generated toHash and opEquals. A opCmp that wouldn't comply with default 
>>> equality also required a custom toHash, which makes it even more unlikely 
>>> that we will break code.
>> 
>> I think there is a misunderstanding, the issue is not that opCmp and 
>> opEquals are not consistent. The problem is this:
>> 
>> 1. As of 2.065, AAs used opCmp and NOT opEquals.
>> 2. Despite the spec's assertion that BOTH opEquals and opCmp should be 
>> defined for AA to work properly, the compiler allowed any combination, and 
>> let the implementation tell the story.
>> 3. All that was required was to override opCmp and toHash to make AAs work.
>> 4. In 2.066, we no longer use opCmp and use opEquals.
>> 5. Without an error, any code that ONLY defined opCmp (and defined it 
>> differently than the default) despite the warnings from the spec will now 
>> silently compile, and do the incorrect thing.
>> 
> 
> The gordian knot is that we cannot add an error or even a warning for correct 
> code as there is no way to be explicit about a missing opEquals (`bool 
> opEquals() = default;`).
> I don't have a good idea here other than emphasizing the changelog and 
> properly describing the state of affairs.
> http://dlang.org/changelog.html#aa-key-requirement

The error is already there. The latest git head removes the error.

BTW, implementing default equals is very simple:

return this.tupleof[] == other.tupleof[];

> 
> This was already released with 2.066 over 2 month ago.
> Has anyone heard of a real issue with this change?

2.066 HAS the error. 2.066.1 would remove it.

The bug report I referred you to is a report that occurred because of the error 
we added.

I suppose by now, anyone keeping up with the times has downloaded the latest 
released version of dmd and found their code issues related to it. I am unaware 
of anyone who has complained except Jacob, but I had a few month hiatus from D 
(one of the reasons I unfortunately missed this discussion from July).

-Steve
_______________________________________________
dmd-beta mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-beta

Reply via email to