Larry said:
> The interesting question to me is what
> 
>     $ref = \$foo.as(Color);
> 
> returns.  It looks like a typed reference to me, but it's still
> a reference to the object in $foo, or can behave as one somehow.
> I don't think it should generate a reference to the bare role,
> because roles aren't intended to be first class objects (though
> you can force them to be, I think).  Roles are supposed to
> encapsulate abstractions without implying objecthood.  I think
> roles are a little bit like quarks--they're fine in theory, but
> it's scary to have loose ones floating around.

Ok, wait a sec. Does that mean different references to the same critter
can have differing sets of aspects?

    my Dog $Spot;
    my $doggie = Dog.new();
    my $meandog  = \$doggie.as(AttackDog);
    my $nicedog  = \$doggie.as(LapDog);
    if $me.away {
        if $visitor.nephew {
           $Spot = $nicedog; 
        } else {
           $Spot = $meandog; 
        }
    }

Now, if I'm away and someone show up, I presume that if it's my nephew
then $Spot.seeVisitor() will invoke the LapDog role's .wag() method,
but otherwise I expect it to invoke the AttackDog role's .Bark()
method. I realize there are other ways to get here.... but would this
*work*???

And btw, just a refresher on this "assigning a ref" thing -- would the
syntax have to change at *all*?


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

Reply via email to