At 10:40 AM 11/28/2003 +0100, Leopold Toetsch wrote:As outlined some time ago, when ops.num made it into the core, we need fix assigned PMC class enums too. (Changed class enums invalidate existing PBC files).
1) lib/Parrot/PMC.pm is the canonical source of PMC class => enum mapping.
2) the class enums should be numbered so that "base" classes come first and dependent classes later.
3) If we keep the current scheme for Const$class generation and switching, we have to use this numbering scheme:
default ... implicitely #0
odd enums ... plain class
even enums ... Const variant of class
4) Where config/* now have $pmc_names, %pmc_types is used.
5) Adding a new class starts with editing PMC.pm. If the current numbering can not be kept, PBC_COMPAT gets an entry too and thus invalidates existing PBCs.
6) The interactive step of selecting PMCs is IMHO unneeded. Its error prone, rarely used PMCs can be dynamically loaded.
7) We probably have to reserve some slots for Perl5-classes
Comments welcome
An additional thought. I feel there is no need to expose the enumerated
values to user-code (bytecode or native methods). Looking up PMCs isn't really
any different than looking up other symbols and could be fixed up at load time.
Except... if we leave the PMC numbers in the bytecode it means one fewer level of indirection when instantiating base Parrot PMCs.
The current scheme allows for two ways to instantiate a new PMC:
1) Via a direct integer constant, which is only valid for PMCs that were in the interpreter when it was built. (And should be usable only for core PMCs we guarantee to be available)
2) Via an integer register. The register can be filled in by looking up the type by name at runtime.
I'd prefer to leave the scheme as is. I'm fine with leaving a small number of PMCs built in as "core" -- I'd be OK going so far as to say that the *only* PMCs available this way are ones that are required for Parrot to operate. (continuations, closures, pads, ordered hashes, and suchlike things)
--
Dan
--------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk