[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Curl, multiple inheritance, and interfaces (was Re: cheerful static typing)

Christopher Barber wrote:
>  - Curl supports multiple inheritance
>    (and thus has no need for interfaces)

Does Curl have some other way of declaring a contract independently from a
specific implementation of that contract?  If not, then I would argue that
there is still a need for interfaces (or an equivalent), despite the
existence of multiple inheritance.

Although it's possible, e.g. in C++, to use abstract classes and multiple
inheritance to achieve the functionality of interfaces, in practice it's
very useful to have an explicit language construct that supports this.  My
experience with Java indicates that it helps programmers think more clearly
about these issues.  A feature like this at the language level has a much
greater influence on programmers than usage conventions - e.g. in Java, it's
impossible to ignore interfaces; in C++, it's easy to ignore abstract
classes and multiple inheritance.

Of course, in many of the little/scripting languages, supporting explicitly
declared interfaces might be considered counter to their design principles,
although I believe a more rigorous approach is possible on an optional
basis.  Curl seems to be taking this approach in other areas - if it's not
doing so with interfaces, why not?  Please forgive me if the answer lies in
my ignorance about the specifics of Curl...