On Monday, 2 May 2016 at 18:14:29 UTC, Basile B. wrote:
On Monday, 2 May 2016 at 17:50:50 UTC, tsbockman wrote:
[...]
That's not how it works currently, but there is no technical
reason it couldn't be *made* to work that way.
Obviously this would be a breaking change though; `this T`
template methods that should retain the current behaviour
could be marked `final`. (Given that non-template methods are
virtual by default, I think requiring template methods to be
marked `final` would improve code clarity, anyway.)
Not that much a breaking change. Perhaps a slight decrease of
the performances...and even not indeed: in all the previous
usages devirtualization of the will be possible.
It's a significant breaking change, because the purpose of it is
to change the output of Andrew Benton's earlier example:
void main() {
Base a = new Base(), b = new Inheritor();
a.writeName.writeln;
b.writeName.writeln; // The semantics of this line changes.
}
Currently, the above will call the `Base` version of
`writeName()` for `b`. With my proposal, it would call the
`Inheritor()` version.