I've been trying to follow the recent discussion on roles and properties and
traits and such, but there's something that bugs me.  If I understand
correctly, adding a role at runtime using but won't override any methods
defined by the class itself (but it will override inherited methods).  But then
if I create a class that has its own method of saying whether it's true or not,
does that mean that "but true" and "but false" won't do anything to it?

class Complex {
has $.real;
has $.imag;

...

#Actually, how do we define this?
method asBoolean(Complex $self:){
    return $self.real || $self.imag;
}


...


then somewhere in a function

    return Complex::new(0,0) but true;

Since Complex already has an implementation of whatever method decides whether
it's true or not, wouldn't just applying a property be insufficient to override
that?
-- 
Adam Lopresto
http://cec.wustl.edu/~adam/

Where now the horse and the rider? Where is the horn that was blowing?
Where is the helm and the hauberk, and the bright hair flowing?
Where is the hand on the harpstring, and the red fire glowing?
Where is the spring and the harvest and the tall corn growing?
They have passed like rain on the mountain, like a wind in the meadow;
The days have gone down in the West behind the hills into shadow.
Who shall gather the smoke of the dead wood burning,
Or behold the flowing years from the Sea returning?

Reply via email to