in reply to Interfaces for the masses!

I know it'd probably never get to that seeing the independent-mindedness of the perl community. But it would be nice, wouln't it?

Well - interfaces are not the only solution to that sort of problem. IMO the Java interface style are are not particularly nice hack to get around problems with multiple inheritance.

Instead of interfaces Perl seems to be heading towards better ways of doing MI with traits/roles - see Class::Trait for example.

Replies are listed 'Best First'.
Re^2: Interfaces for the masses!
by rvosa (Curate) on Mar 24, 2006 at 01:15 UTC
    traits/roles are going to be a boon. In a way, though, by saying that some class does some role you are entering into a contract not completely dissimilar to interfaces, right? (That is, if I understand what I've read of the Apocalypses and Synopses correctly.)

      An interface (as you describe it, similar to the Java concept) is a degenerate case of a role. A role can provide default (and even parametrized) implementations of the appropriate methods and can disambiguate dispatch at compile time.

      Hopefully, Perl 6 will even also be able to dispatch multimethods based on roles.