<?xml version="1.0" encoding="windows-1252"?>
<node id="666342" title="[parrot] parrot prototype OO?" created="2008-02-05 11:39:15" updated="2008-02-05 06:39:15">
<type id="115">
perlquestion</type>
<author id="31548">
jepri</author>
<data>
<field name="doctext">
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.
&lt;P&gt;
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.&lt;P&gt;
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.&lt;P&gt;
Does anyone have some hot ideas on how to arrange inheritance between objects in parrot?  Or to give classes methods?&lt;P&gt;
* 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 &lt;i&gt;objects&lt;/i&gt;.
&lt;P&gt;
(Edit) References:&lt;br&gt;
&lt;a href="http://en.wikipedia.org/wiki/Prototype-based_programming"&gt;Prototypes explained&lt;/a&gt;&lt;br&gt;
&lt;a href="http://www.parrotcode.org/docs/pdd/pdd15_objects.html"&gt;PDD15&lt;/a&gt;&lt;br&gt;
&lt;a href="http://search.cpan.org/~teverett/Class-Prototyped-1.11/lib/Class/Prototyped.pm"&gt;Prototypes in Perl5&lt;/a&gt;
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-31548"&gt;
&lt;p&gt;___________________&lt;BR&gt;
Jeremy&lt;BR&gt;
I didn't believe in evil until I dated it.
&lt;/div&gt;&lt;/div&gt;</field>
</data>
</node>
