[help]operator overloading with opEquals in a class

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Nov 29 08:09:55 PST 2010


On 26/11/2010 16:56, Andrei Alexandrescu wrote:
> On 11/26/10 9:30 AM, Bruno Medeiros wrote:
>> On 03/11/2010 20:33, Andrei Alexandrescu wrote:
>>> On 11/3/10 7:07 AM, zhang wrote:
>>>> This code belown can be compiled with DMD 2.050. However, it throws an
>>>> error message:
>>>> core.exception.HiddenFuncError: Hidden method called for main.AClass
>>>>
>>>> I'm not sure about whether it is a bug. Thanks for any help.
>>> [snip]
>>>
>>> That hidden functions are signaled during run time and not compile time
>>> is a misunderstanding between design and implementation. There should
>>> not be a HiddenFunc exception and the compiler should just refuse to
>>> compile the program.
>>>
>>>
>>> Andrei
>>>
>>
>> Indeed! Is this part of the spec, or has Walter not agreed to it?
>
> I think he was worried about the compiler becoming too restrictive.
>
> Andrei

Well... I don't even know how to argue against that. I mean, when would 
a programmer ever prefer a runtime error instead of a compile-time one 
in this scenario?
It's akin to saying the override keyword should never create a 
compile-time error, but instead throw a runtime one if the 
override-marked method doesn't actually override a super method.

(note: I know it's not your reasoning, but Walter's)

-- 
Bruno Medeiros - Software Engineer


More information about the Digitalmars-d mailing list