Re: [perl #48014] [DEPRECATED] PMC union struct
[email protected] (Allison Randal) Fri, 16 Jan 2009 20:43:21 -0800
| Newsgroups | perl.perl6.internals |
|---|---|
| Message-ID | <[email protected]> |
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