Being generally in favor of moving quickly toward a 1.0 release, I'm
looking at this from the perspective of "what's essential and what's not
essential"?
Allison Randal wrote:
I'd like to do away with the PMC_DATA_IN_EXT flag so the "DPOINTER
*data;" struct element is always in the PMC struct instead of being
sometimes in the PMC struct and sometimes in the PMC_EXT struct. Access
is all hidden behind macros anyway, so the change shouldn't affect
anything outside of include/parrot/pobj.h. And, PMC_DATA_IN_EXT is
currently set to 1 in include/parrot/pobj.h, and never unset anywhere in
the repository.
This change we might as well go ahead and make. There's no reason to
have *data in two alternate locations. Let's put it in PMC_EXT (which is
where it is now because of the fixed-value flag).
Combining this with the proposal to give PMCs a vtable function
responsible for constructing the PMC: calling the C<new> opcode
constructs the core PMC struct for all PMCs, and then calls the
C<construct> (or C<create>) vtable function. Each PMC that overrides
C<construct> creates its own struct to store in C<data>. The C<default>
PMC's C<construct> does nothing. C<construct> is separated from C<init>
so they can be overridden separately.
To accommodate low-level role composition, the C<data> struct for a PMC
isn't defined directly in C, it's defined with a bit of Pmc2c syntactic
sugar. Pmc2c takes all the struct members defined in the PMC and in any
compile-time roles and builds them into one struct for the PMC. Also
included are any struct members defined in inherited PMCs. (A PMC is not
permitted to redefine any struct members defined in parents, and roles
may not contain struct members of the same name. Yes, this is rather
strict, but it is C.)
We add this functionality without removing or changing any of the old
functionality. PMCs that want to use compile-time composition have to
use this interface for defining the core attributes, but with other PMCs
it's optional.
Low-level PMCs can also have roles composed at runtime, but these are
entirely different creatures. They are added through the C<add_role>
vtable function and live in a PMC data structure that hangs off the
PMC_EXT struct. Runtime composed roles are Role PMCs or subclasses of
the Role PMC.
We add another pointer to PMC_EXT.
No other changes are really necessary to get to the 1.0 release.
Allison