[perl #48014] [DEPRECATED] PMC union struct

Allison Randal allison at parrot.org
Sat Jan 17 04:43:21 UTC 2009


Christoph Otto via RT wrote:
> I'm running into a snag trying to implement this.  It turns out that
> many lines which use the PMC_x_val macros use them on different types of
> PMCs, especially parents and children (e.g. FixedPMCArray and
> ResizablePMCArray).  There are also some instances where the PMCs with a
> related purpose but no inheritance (e.g. RetContinuation and
> ExceptionHandler) have the unionval used in the same way on a line of code.
> 
> What's the right way to fix these cases to use the GETATTR/SETATTR macros?

Tough to answer without looking at the code, but... The 
GET_ATTR/SET_ATTR macros will work on inherited attributes as well as 
child attributes. (Actually, at the moment you're required to declare 
all parent attributes in the ATTR list before the child attributes, so 
inherited attributes *are* child attributes.)

If two unrelated PMCs are being called in the same line of code, that 
probably means it should really be a vtable function call instead of 
direct access into the data struct.

Allison


More information about the parrot-dev mailing list