Slow performance compared to C++, ideas?
Max Samukha
maxsamukha at gmail.com
Wed Jun 5 22:52:28 PDT 2013
On Wednesday, 5 June 2013 at 22:03:05 UTC, Walter Bright wrote:
> 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'.
Note that 'new' modifier in C# is applicable not only to virtual
methods (MS calls it "name hiding"). Not using 'new' when hiding
a public member is a warning.
References:
http://msdn.microsoft.com/en-us/library/vstudio/435f1dw2.aspx
http://msdn.microsoft.com/en-us/library/aa691135(v=vs.71).aspx
http://msdn.microsoft.com/en-us/library/aa645767(v=vs.71).aspx
Some points from limited personal experience:
1. Private final methods in D can hide base methods. That's
*useful*. Don't try to change that.
2. Public final methods in D cannot be hidden. That's been a
problem for me and other people.
3. I've seen 'new' on final methods in C# in practice and used it
myself. I've never seen virtual methods being hidden and never
needed that myself.
>
> 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.
More information about the Digitalmars-d
mailing list