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

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

> Christopher Barber wrote:
> > Curl does require that abstract classes be explicitly marked
> but does not
> > require abstract classes to only contain abstract methods.
> That's pretty standard.  You're right that for proper interface support, a
> stricter construct is needed, other than abstract classes.
> > We have
> > considered having a stricter version of this, but felt that it was not
> > useful enough to add to the language.
> Not useful enough?!? ;o)

It is not useful enough because you can enforce the extra level of
strictness pretty easily merely by programming convention.

 > but I'd like to add to it: if you think about it, an interface or
> (or whatever you choose to call it, possibly including 'type') is
> one of the
> most fundamental constructs in any programming language.

Sure, but Curl already has "interfaces" in the form of classes and other
static type declarations.  It just don't use the actual word "interface".

> It seems reasonable - and actually quite important - to require a
> declaration more like:
> >    {define-class Mutex implements Lockable

How does this differ from inheriting from an abstract class, which Curl
already supports?

> If you're suggesting that simply because a class happens to
> include methods
> that match a particular interface, that it should satisfy that
> interface, I
> don't think that's a very good idea.

That is what I am suggesting.  I have mixed feelings about it, but many
would argue this is a useful concept.

- Christopher