|Welcome to the Monastery|
[parrot] parrot prototype OO?by jepri (Parson)
|on Feb 05, 2008 at 16:39 UTC||Need Help??|
jepri has asked for the
wisdom of the Perl Monks concerning the following question:
So I sat down to see if I could do some prototype style programming in parrot (my goal was to see if I could implement a prototype-style system in PIR). It didn't go well.
At first I thought to simply subvert the classes and use them as objects, but there are no class methods, so that was out. Then I thought I might try to mess with the metaclass, which does appear to have "class methods", but when I cloned it I couldn't seem to make one the parent of the other.
So it seems I'm left with writing my own prototype PMCs (ouch), writing some complex objects to proxy calls, or throwing the whole lot away and doing it all with closures. I might have missed a trick, but PDD15 gets prototypes slightly wrong*, so I suspect there really is no good way to do it right now.
Does anyone have some hot ideas on how to arrange inheritance between objects in parrot? Or to give classes methods?
* It states that prototype systems have no classes, but skips over the fact they still have inheritance. A better way to put it might be that prototype systems don't have objects.