Will Coleda <[EMAIL PROTECTED]> wrote:

> I don't understand what enum_class_TclString is doing in

> Parrot_TclString_class_init(Parrot_Interp interp, int entry)
> {
>      struct _vtable temp_base_vtable = {
>          NULL,   /* package */
>          enum_class_TclString,   /* base_type */


> If I'm being dynamically generated, and I'm supposed to use the real
> values when morphing - what purpose does this serve? is it just a
> placeholder?

On compilation of the C file C<enum_class_TclString> is a placeholder.
Static classes have these enums in F<include/parrot/core_pmcs.h>,
which is autogenerated by Configure.

Dynamically loaded PMCs don't have an entry in that file, so there isn't
any static enum_class_xxx. To make the code compile, a dummy define is
(currently) necessary that makes the compiler happy.

During loading of the dynamic class vtable->base_type is filled with the
correct enum value.

> ... And if so, why not just automatically gen it with -1 to
> avoid this issue?

No problem, patches welcome that include this line for the dynamic case.

> ... Or is this base_type used elsewhere... in which case
> does it have to be unique? across ALL dynamic pmcs? (and, if so, how do
> we insure that)

It's unique across the whole parrot process. This is assured by the PMC
registration code. But it of course depends on load order of dynamic
classes.

Hope that this helps a bit.

leo

Reply via email to