As I understand it, in Perl 6 a method of a class, as indeed all similar things like a sub or a regex, is represented by an object. If it's an object, I should be able to mix a role into it, right? Something like:
role Fancy { has $.something is rw; } sub a { } &a does Fancy; &a.something = 56; say &a.something; a(); And so forth. Now, Rakudo's got a whole load of bugs I'm tripping over trying to do things like this, but I thought I'd check to see if it's supposed to be possible, and if it isn't, why not. Also syntactically, is there or should there be a way to do it which doesn't involve having to haul out the &a afterwards - so can the 'does' or maybe a 'but' be attached to the definition itself? As for why I want to do this, I've got something in mind which would be potentially much nicer if some methods can carry a load of extra data around with them - which seems like an excellent use for a mixin, especially as I could then smartmatch against it in order to pick out the relevant methods from the .^methods list. Matthew