Dan Sugalski writes: : At 06:52 PM 11/15/2001 +0000, Simon Cozens wrote: : >I've hit upon quite a major problem with implementing : >Perl scalar PMCs. The problem is that the code is just : >too damned ugly for words. : > : >Remember that PMCs have a data area which is a void : >pointer; I'm connecting that to a structure which has : >integer, number and string slots. Those of you familiar : >with Perl SVs will know exactly where I'm coming from. : : Ah, perl 5 SVs. Exactly what I was trying to avoid. :) : : >Any suggestions for cleaning up this crap and making it a bit : >more maintainable? : : Couple of things: : : *) Use the cache entry in the PMC header. It'll mean for ints and floats : you won't need to bother with a separate structure or dereference : : *) Swap out vtables as the pmc internals change, rather than vectoring off : flags. : : Yeah, some of the code will be a little grotty, but not as bad as you might : think.
I think that as soon as the concept of a cache starts producing bit flags and unions and cascaded if/then/elses, it's probably a bad concept. Larry