On Tue, 02 Apr 2013 01:22:26 -0400, Maxim Fomin <ma...@maxim-fomin.ru> wrote:

On Monday, 1 April 2013 at 23:56:08 UTC, Steven Schveighoffer wrote:
No, AA's are not classes (which BTW have had that problem fixed), they are pImpl structs. The equals operator should check for null before comparing the contents. It is a valid bug.

-Steve

This argument can be applied to classes too. I think it would be better to reject such code like in case with classes.

If you are saying you think AA's should reject the code when comparing to null, then I don't agree. An AA is a struct, and a struct lives on the stack. It would be near impossible to make this work without arbitrary compiler help, and I don't see a reason to specifically add this. It's just as easy to check for null in opEquals.

With classes there was NO way to intercept the comparison before the dereference, so the banning of == null was warranted (that situation has changed now that opEquals is a global runtime function, so this requirement is somewhat moot).

-Steve

Reply via email to