OK, I did a little (stress "little") work on PMCs this weekend. 
Let me just explain how I see PMCs as working, and then I'll explain what
I've done.

PMCs are essentially objects on which methods are called. These objects
will usually come from pre-defined "classes": Parrot will ship with a bunch
of default "base" classes which provide sensible (currently Perl-like, but
that's open to change if anyone else codes some non-Perl-like) behaviour.
There'll be an integer class, a scalar class, and so on. Of course, people
are more than welcome to swap in their own methods at any point - at the
moment, PMCs get a pointer to a vtable, but it might come to the point
where they'll need a private copy so they can modify it.

You call methods on PMCs either like this:
    (pmc1->vtable->is_same)(pmc1, pmc2)
or like this:
    (pmc->vtable->set_integer[2])(pmc, intval)

PMCs are created either by calling a bootstrapping "pmc_new" function, or
by calling a PMC's "new" method to get a new PMC with the same vtable.
In the former case, you pass in an index to Parrot's array of base classes.

So, what have I done so far? Firstly, I've moved the PMC structure out of
parrot.h and into pmc.h, and added an enum for the base classes. I've decided
that we ought to put classes in a subdirectory, so I've created classes/, and
have added a program genclass.pl which takes the name of a class and spits out
a C skeleton to help you implement it. I've also added a (undocumented, yes,
I'm a bad boy) utility function to Parrot::Vtable, which enumerates all the
vtable methods with their types *including* multimethods, and I've updated
its idea of the vtable structure to include PACKAGE and that sort of thing.
I've also started on pmc_new. Implementing vtable methods should be relatively
straightforward now.

Any questions? :)

-- 
"He was a modest, good-humored boy.  It was Oxford that made him insufferable."

Reply via email to