October 11, 2002 Re: Port Divergence (was Re: forgetting to call super doesn't call any super constructors.) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Wynn | "Mike Wynn" <mike.wynn@l8night.co.uk> wrote in message news:ao28o3$2mvi$1@digitaldaemon.com... > but what about the statment ... > A reimplemented interface must implement all the interface functions, it > does not inherit them from a super class > I do not understand you should implements all of an reinplemented interface, > if you what to modify part of it, but not all them you can not comment your > code to say 'I implement X' The idea is if you respecify the interface, you intend to reimplement it. > There are differences between the Java signaure based interface and the > multipul vtbl approach, > the Java Style CAN be implemented as separate vtbls BUT multipul vtbl CAN > NOT be implemented with the method signature alone as it allows two > interfaces to have the same signature but different implementations within a > single class. The vtbl[] can be set up to be anything the compiler implementor wants. The only issue is what semantics make sense. > > > 1) it is a lot faster > > 2) working with COM requires it > I know, when I worked on a JavaVM I suggested it was used to speed up interface calls but it was rejected on the grounds of extra memory usage (and with a JavaVM you'd still have to search for the right vtbl). Yes, it will use more memory. D, though in general will use less memory because far fewer class objects are needed. > > the docs do not say what will happen with > > interface D > { > int foo(); > } > > interface E > { > int foo(); > } > > class A : D > { > int foo() { return 1; } > } > > class B : A, E > { > int foo() { return 2; } > } > > which is valid within COM interfaces B.foo() is used for D.foo() and E.foo(). > > or worse > > interface D > { > int foo(); > } > > interface E > { > int foo(); > } > > class A : D > { > int foo() { return 1; } > } > > class B : A, E > { > int foo() { return 2; } > } > > class C : B > { > int foo() { return 2; } // which foo is this foo; D or E ? > } Both. |
Copyright © 1999-2021 by the D Language Foundation