Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2022-05-19 18:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (72 votes). Check out past polls.

    Notices?