On Wed, 26 Jun 2002, Dave Goehrig wrote: > 1.) Data creation function having both of the following properties: > a.) Create & register new PMCs > b.) Toggle GC on/off > > say with the following API for sake of arugment: > let TYPE be either a char* or an enum
I'd suggest having types be integers handed out at run-time. That way you can create new types on the fly, load libraries, etc, without worrying about conflicts, and without getting into nasty string shenanigans. ID's for builtin types could be handed out ahead of time to reduce startup costs. So maybe the API could have another function: int parrot_new_type(PMC * type) that is called to let the system know about a new type. (Do we need "parrot_fuggedaboutit()" as well?). The argument is just an ordinary PMC with a known interface that can produce info about the new type (parent types, maybe constructor, etc.). > 3.) Hook functions for registering PMCs & functions with > an environment / namespace support subsystem: > a.) bool parrot_bind ( char *name, PMC *data ); > c.) bool parrot_bind ( char *name, PMC* (*func)(PMC*,PMC*) ); > d.) PMC* parrot_lookup ( char *name ); Given Larry's suggestions about module aliasing, these should probably be able to bind names relative to the current namespace, without necessarily knowing its name. So we might want to have an extra namespace argument for all these functions, and a couple of functions to manipulate namespaces. Just-words-no-code, though, /s