Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Greetings mkirank,
In MetaModel.pm at the beginning there is an import function wherein the following subs are put in the name space

It should be noted that these functions (class, role) are merely for helper functions, and will not be part of the eventual Perl 6 metamodel. They exist mostly to make class and role composition easier during testing. As for the (_ and __) functions, those are to make class attribute access easier, so you can say _('$.foo') which will eventually become just $.foo in Perl 6.

when the Object module is loaded the sub class in the Metamodel is called.

Yes, this is because Object (the base Object class in the Perl 6 OO system) is now defined purely by the meta-model itself. The other classes in the MetaModel folder are the "meta" level components, while the Object is a "user" level component.

Of course the lines between "user" and "meta" are blurred because Perl 6 is a highly reflective OO language, and you will have access to the "meta" level at all times.

What happens when the below code is executed ?

The $name and $params are passed to Perl6::Class->new(), which then composes the Perl6::MetaClass for that given class, and sets up the new class within the runtime environment. It might be useful to think of the class model like this:

  • A MetaClass has a method table, attribute descriptions and superclass list.
  • A Class has a metaclass instance.
  • An Instance has a Class pointer and local attribute storage

how do those subs with "DUMMY" get created

This is just the way Data::Dumper represents the internals of a sub. I have nothing to do with it :)

I apologize for the lack of documentation in these packages right now. I did not want to write too much until I felt the design was more finalized. I might try to write something this week if I have time.

You might also find the Javascript and Java versions interesting and/or informative. The Javascript version is mostly complete, except for Roles and class attributes, while the Java version is much less complete.

-stvn

In reply to Re: Perl6 MetaModel by stvn
in thread Perl6 MetaModel by mkirank

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 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?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-26 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found