First: you can do it for all objects by extending the class that provides the Array functionality.
Well, of course I knew that... but I specifically wanted to act on a specific object, which is why I mentioned prototype-based languages.
Now to return to your original question: There are are surely ways to do it, I don't know if there is a clean one.
Well, it would be nice if there were: of course what is easy in such relatively simple languages must be simple enough for a language that's supposed to be very complex but still to make hard things easy, and thinking of huffmanization: yes, one wouldn't this kinda things as often as other OO contructs, so it is ok to be slightly more difficult to achieve, but not too much. How much is too much?
In reply to Re^2: [Perl 6] Object methods on the fly?
by blazar
in thread [Perl 6] Object methods on the fly?
by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |