Should operator overload methods be virtual?

dsimcha dsimcha at yahoo.com
Sat Nov 28 06:40:15 PST 2009


== Quote from retard (re at tard.com.invalid)'s article
> Sat, 28 Nov 2009 08:16:33 -0500, bearophile wrote:
> > dsimcha:
> >> but it would introduce an
> >> inconsistency into the language relative to "regular" methods.
> >
> > Right, it's an exception to a rule of the language, so it increases the
> > language complexity.
> I guess the systems programming language users more often think that
> 'more executable bloat when compiled with the currently available
> practical real world tools, the more complex the language in practical
> real world use'. So if there's some tiny little feature that saves you
> 1-2 cpu cycles in practical real world systems programming applications
> or makes building a practical real world non-academic commercial compiler
> a bit easier and thus provides more practical value to the paying
> customer, the language should include that feature.

Ok, well then how does making operator overloads implicitly final improve over
being consistent with the rest of the language and making them explicitly final if
you want them final?

Note:  I'm not against making overloading non-virtual if it's implemented with
templates, because this is non-arbitrary and consistent with the rest of the
language.  I'm only against it if it's done arbitrarily by treating operator
overload functions as "special" in this regard.



More information about the Digitalmars-d mailing list