Dan Sugalski <[EMAIL PROTECTED]> wrote:
> At 12:43 +0200 7/30/03, Leopold Toetsch wrote:
>>I have started looking at dynamic classes. I have currently
>>- new subdirectory /dynclasses
>>- small hack for classes/pmc2c.pl to consider this directory too
>>- dynclasses/foo.pmc, dynclasses/Makefile (unportable, but short ;-)

> Here's what I was thinking instead.

> We build classes as shared libraries, unless otherwise noted. PMC
> libraries get loaded up with an op--load_pmc or something of the
> sort. It takes a PMC name and tacks on the library prefix and suffix
> as need be.

So we first need some more Configure support:
- runtime directory
- path separator
- $(SO) extension

(The dynclasses subdir is ment for building these libs, not for loading
them from there [1])

> ... We load in the PMC library, call its setup routine, call
> its initialization routine, and let it do its thing.

The split into C<setup> and <class_init> is necessary for our static
PMCs too. Mainly ParrotIO is using the current class_init hook to work
around initialization order and to setup its method table. [2]

> ... The setup
> routine, when called, will at the least register the PMC's class in
> the class name hash. There should be some code in the system to
> manage this, though it needs mutex protection.

IMHO: The class_setup loads the class into the global
Parrot_base_vtables. The class_init registers the class in a per
interpreter class name hash. Different threads might have different
classes loaded, but the class_enums have to be uniq.

> *) Determine the init and setup routine names

- Parrot_<classname>_class_setup
- Parrot_<classname>_class_init

The class_setup also sets the class_enum i.e vtable->base_type.

> *) Make some standard for library paths and names

- runtime/parrot/pmc

> *) Figure out how we want to handle versioning

brrr, I need a Ponie ;-)

[1] If there are no objections I'll check that part in. It shouldn't be
too hard, to finally have a perl script, that generates a platform
independend Makefile out from %PConfig.

[2] Somehow related: There was some discussion about PMC methods.
What about a standard way to allow methods for (almost) all PMCs:
- have a vtable slot for the method hash
- move find_method into default.pmc
- PMCs used in that process mainly PerlHash should better not have
  methods ;-)

leo

Reply via email to