All right, all right! Interim decision regarding qualified Object methods

Steven Schveighoffer schveiguy at yahoo.com
Fri Jul 13 04:44:20 PDT 2012


On Fri, 13 Jul 2012 02:49:01 -0400, Jacob Carlborg <doob at me.com> wrote:

> On 2012-07-12 22:20, Steven Schveighoffer wrote:
>
>> Many (most?) classes never care about opHash, opCmp, opEquals and
>> toString.  But Object defines them, incorrectly for most cases.
>>
>> These apathetic classes would not break at all.  And to make the default
>> be to inherit those methods would promote their usage or reliance on  
>> them.
>>
>> Not only that, but you are almost *forced* to define them, because you
>> don't want accidental incorrect usage of them.  We have lovely
>> situations where the only solution is to define a version of the method
>> that *always throws* in a statically typed language.
>>
>> It's really a terrible solution (to force the definition of them) which
>> Andrei quite correctly pointed out only existed because of the lack of
>> templates back then.
>>
>> I think this discussion is somewhat academic at this point, as Andrei
>> seems not too keen on the idea of having dual base classes.
>
> I was trying to suggest something that is mostly backwards compatible.
>

I understand.  I don't think it's worth it.  I'd rather opt-in to the old  
way than opt-out.  People are lazy, they will likely avoid specifying an  
alternate base class.

-Steve


More information about the Digitalmars-d mailing list