On 6/5/2013 2:55 PM, Walter Bright wrote:
On 6/5/2013 1:13 PM, Andrei Alexandrescu wrote:
On 6/5/13 4:01 PM, Kapps wrote:
Anders Hejlsberg talks about why they decided to use final by default in
C# at http://www.artima.com/intv/nonvirtualP.html. See the Non-Virtual
is the Default section. They do this *because* they saw the drawbacks of
Java's virtual by default and were able to learn from it.

This is a solid piece of evidence.

Yup.


We can do an upgrade path as follows:

1. Introduce 'virtual' storage class. 'virtual' not only means a method is virtual, but it is an *introducing* virtual, i.e. it starts a new vtbl[] entry even if there's a virtual of the same name in the base classes. This means that functions marked 'virtual' do not override functions marked 'virtual'.

2. Issue a warning if a function overrides a function that is not marked 
'virtual'.

3. Deprecate (2).

4. Error (2), and make non-virtual the default.

Reply via email to