override(T)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Sep 24 09:59:12 PDT 2009


Max Samukha wrote:
> On Thu, 24 Sep 2009 23:55:57 +0800, Lionello Lunesu
> <lio at lunesu.remove.com> wrote:
> 
>> Daniel Keep wrote:
>>> Why not go with what C# uses?
>>>
>>> class LotterySimulation : Lottery, Figure {
>>>     override void Lottery.draw();
>>>     override void Figure.draw();
>>> }
>>>
>>> Just seems like a more obvious and natural place for it to me.  D
>>> already uses this to disambiguate symbols in other places.
>> I actually like Andrei's suggestion a lot more! It's far more natural:
>> try reading both versions out loud.
> 
> C# uses familiar syntax to qualify the function name. I think it's
> natural enough.
> 
>> Making it look like C# has bad sides too. Explicit overriding in C#
>> always hides the member from the public view. So this "like C#" can
>> easily backfire.
> 
> According to Andrei's suggestion, the implemented functions are
> effectively hidden. You can call them only through the interfaces.
> 
>> ++andreis_suggestion;
> 
> I give my vote to C#'s syntax if D can adopt it.
>> L.
> 

Yah. My take is that if we depart from familiarity, we ought to have a 
pretty darn good reason. I didn't know C# has the feature. Since it does 
with a reasonable notation, I'd say let's go for it.

Andrei



More information about the Digitalmars-d mailing list