On Tuesday, 27 October 2015 at 14:47:03 UTC, bitwise wrote:
[...]
Going a bit further, I think you could override an auto
override fun too manually as well. This would be helpful both
for adding additional functionality, and as a fallback if the
definition of the auto override function was not available. If
someone sub classed a class in which they had manually
overridden an auto override function, the compiler would fall
back to using the base method, if available. Finally(pun
intended), a user could manually override an auto override
function and mark it as final to stop the automatic overriding.
Bit
Is there ever a chance the auto override definition would not be
available, I think the class chain all the way up to Object
always needs to be available at compile time to compile a class,
so I don't see any time an auto override definition would be
missing.
I do like the idea of manually overriding as well if needed, but
with slightly different semantics than what you said.
-Manually overriding an auto override with a regular method would
simply work and would stop the automatic overriding from that
class on.
-Overriding an auto override with another auto override would
cause the new auto override to be used from that class on.
-Final could still be used to stop all overriding from that class
on.
You could even override a normal method with an auto override and
have no problems.