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.

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.

They share all other properties of interface class.

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.

Hong

Michael G Schwern wrote:

> Rather than stumbling around in the dark here, is anyone actually
> experienced with object inheritance?  Any Self programmers out there?
> Someone that's actually used this technique often and understands what
> works and what does?  Any books/articles to recommend?

Its not quite the same thing, but Java does have the concept of
anonymous classes (it names them 'inner' classes): Is Perl6 going
to have a similar concept?


Dave.
--
Dave Whipp, Senior Verification Engineer,
Fast-Chip inc., 950 Kifer Rd, Sunnyvale, CA. 94086
tel: 408 523 8071; http://www.fast-chip.com
Opinions my own; statements of fact may be in error. 

Reply via email to