There was a thread back in May where I asked about how Ponie should implement perl 5 SvFLAGS() lookups in a way that is
1: Correct 2: Fast 3: Works on both Perl 5 subtype PMCs created by Ponie, and any other PMCs that happen to arrive inside ponie. The thread was inconclusive. But seemed to back up my contention that this is a problem that needs solving, because a lot of existing XS code (and the parts of the perl core we don't want/need to rewrite) make a lot of flags tests. Anyway, my assumption was that to Perl code (code using a Perl 5 API to access things) 0: Scalars Ponie created appear with flags values consistent with the classic Perl 5 implementation 1: Scalar PMCs of non Ponie types appear to have flags and other behaviour consistent with a Perl 5 tied scalar. 2: Array PMCs of non Ponie type(s) appear to have flags and other behaviour consistent with a Perl 5 tied array 3: Hash PMCs of non Ponie types appear to have flags and other behaviour consistent with a Perl 5 tied hash. Which seems to get down to I need a way to rapidly partition things into "one of mine/not one of mine". eg #define SvOK(pmc) (ponie_pmc(pmc) ? direct access... : emulation_function(pmc)) where direct access accesses one of the 8 private PMC flags, and emulation function does fakery. However, I'm still stuck on: #define ponie_pmc(pmc) ??? here ??? The problem is that ponie PMCs are created dynamically so they don't have fixed type numbers. They might not even be contiguous types, so a (min < type() max) test won't work. It seems sensible to assume that more types might get registered after compile time (transitional XS modules should be allowed to play along and define their own derived PMC types) I was wondering about 2 possible ways 1: A bitmask of all PMC types. Possibly using the FDSET() etc macros. Bit is set if that type is a ponie PMC and supports Ponie's private flag arrangement and certain PMC methods 2: Finding some PMC method in the vtable that ponie doesn't use, or rarely uses, and declaring that all Ponie PMCs use the standard implementation. (The standard implementation might redispatch based on type, but I said something rare) Any other suggestions on how to rapidly partition PMCs? Option 2 is actually more appealing. It's a simple equality comparison (albeit down a pointer dereference) Nicholas Clark