The attached patch (plus two files and an example) is a simple
implementation of methods, plus the following three methods for PerlArray:

@a.length: return @a's length
@a.get_item($n): get the $nth item in @a
@a.stash: get @a's (well, PerlArray's) stash hash

This last lets you define methods written in Parrot assembly.  It's not
exactly pretty, but it works.  Note that the methods use pdd02 calling
conventions rather than IMCC ones, so getting them to work in anything
IMCC-based (e.g. P6C) would require a bit of glue.

If no one cries out in pain within the next couple of days, I'll put this
in CVS (likewise for the comparison ops patch, posted earlier).

/s

Attachment: methods.tgz
Description: Binary data

Reply via email to