On 4/10/13, Manu <turkey...@gmail.com> wrote: > The _problem_ is that functions are virtual by default. > It's a trivial problem to solve, however it's a major breaking change, so > it will never happen.
I wouldn't say never. In fact, it might go hand-in-hand with changing how protection attributes affect virtuality (currently they do, I'd argue they shouldn't) For example one argument against allowing private and package methods the ability to be virtual is performance, namely these methods are now non-virtual and would suddenly become virtual if we allowed private/package overrides (because users typically don't mark private/package methods as final). However if we at the same time introduced a virtual keyword, then the private/package methods would remain non-virtual. What would break are public methods which are overriden but don't use the virtual keyword. So it's a breaking change but at least you won't get any performance degradation by accident. Another reason I like the idea of a virtual keyword is that it documents the method better. The user of a library would clearly see a method can be overriden because it's marked as virtual, rather than having to guess whether the method was left non-final on purpose or by accident (accidents like that can happen..).