Sorry if this has already been asked and answered, but in doing a little research 
about Perl 6
mixins (, I ran into some questions 
that I
couldn't figure from either A12 or "Perl 6 and Parrot Essentials."

First, how does one access the instance in a constructor?  Let's say I need to create 
a child node
of a parent node:

  method new(Class $class: Node $parent) {
    $:parent = $parent;
    my $self = $class.bless(0, $parent); # is this correct?
    return $self;

I'm also trying to figure out method disambiguation with mixins.  A12 states that 
mixins are to be
implemented via anonymous inner classes and related via inheritence.  Thus, a later 
mixin will
override a previous mixin, but this seems to cause the problems we already have with 

  $driver does SanitationEngineer does RaceCarDriver;

So my $driver who does some racing as a hobby now has no choice but to drive his dump 
truck like
mad through the streets.  That dump truck had better have darn good brakes.  Is there 
some other
method (pun not intended, but I'll take it) of disambiguating these?  The delegation 
syntax looked
promising, but it seemed to be a compile-time tool.


Silence is Evil  
Web Programming with Perl

Reply via email to