On Thu, Jul 05, 2001 at 11:04:29AM -0700, Hong Zhang wrote:
> I don't think object inheritence has any significant advantage.
> Since it is not widely used and understood, we should not use it
> in Perl, period.

*cough* A little harsh.


> Its functionality can be achieved by many different ways. The 
> anonymous class is one of them. Personally I prefer using mixin.
> 
> The mixin is similar to Java interface. The differences are that
> a) mixin can have instance fields, but they must be private.
> b) mixin can have method implementations.
> c) mixin can not have superclass.

Why no superclass?


> Here is an example:
> 
> public mixin Node
> {
>   private Node next, prev;
> 
>   public Node next() { return next; }
>   public void next(Node n) { next = n; }
>   public Node prev() { return prev; }
>   public void prev(Node n) { prev = n; }  
> }
> 
> Say if you want Thread can be easily inserted into LinkedList,
> you can write
> 
> public Thread extends Object implements Node {
>   ...
> }
> 
> or
> 
> public Thread extends Object, Node {
>   ...
> }
> 
> and don't bother to implement classic linked list node.

Given that Perl doesn't really have to worry about strict typing or
interfaces (at the very least it will be very optional in Perl 6) what
problem is this solving?

And how would this solve the Mail problem put forth by Ziggy?


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
I'm not actually Kevin Lenzo, but I play him on TV.

Reply via email to