Larry Wall writes: > Anyway, this all implies that use of a role as a method name defaults to > returning whether the type in question matches the subtype. That is, > when you say > > $foo.true > > it's asking whether the Boolean property fulfills the true constraint. > When you say > > $bar.red
So are you saying that, eg. class Something does Color {...} my Something $flib; if $flib.red { print "Flib is red" } if $flib.true { print "Should be an error before now" } Since Something doesn't Boolean, true would be a "method not found" error? If that's the case, how do we attach out-of-band properties on objects that don't expect them, but only some of them (as was the original intent for properties, IIRC): my role onlyonced; sub onlyonce($arg is rw) { die "onlyonce called twice on the same value" if $arg.onlyonced; $arg but= onlyonced; } Either that doesn't work at all, because you get an "onlyonced not found" error, or it works because onlyonced is a declared role. But in the latter case I worry about namespace pollution. It's clear that I don't entirely understand all of this yet (er, as much as there is to understand... yet). Luke