Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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.

(Edit) References:
Prototypes explained
PDD15
Prototypes in Perl5

___________________
Jeremy
I didn't believe in evil until I dated it.


In reply to [parrot] parrot prototype OO? by jepri

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (7)
    As of 2014-11-28 07:17 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My preferred Perl binaries come from:














      Results (193 votes), past polls