This needs some docs, but I figured I'd throw out the short description to the list since they've come up, and we ought to finish them.

For parrot, interfaces are *very* simple things. An interface is a string tag which can be attached to a class. Each class can have multiple interface tags attached to it. The does op walks an object's hierarchy looking to see if any class in the hierarchy has the queried interface tag.

That's it. Very simple. There's no checking of class names or anything -- if a class implements an interface of the same name then it should tag itself as implementing an interface with the class name.

The whole point of the interface design here is so code that checks to see if an object can do something can check to see if an object implements the interface:

    object.does("Storable");

rather than seeing if the object implements a particular method:

    object.can("freeze");

or is in a particular class:

    object.isa("Storable");

since presumably interfaces are a bit more uniquely named than methods, and an object may be able to do something some class does while not actually being in that class.

Interfaces aren't inheritable, have no metadata, aren't orange, can't be instantiated, and have no methods/attributes/slots/properties.

Now, that's not to say that a language can't have something it calls an interface which has slots or methods or can be inherited from. That's fine. (Granted, it'd be a parrot class with an interface attached, rather than a pure parrot interface, but there's nothing saying what *you* call something has to match what *we* call something :)
--
Dan


--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to