At 12:15 AM 1/10/2002 +0000, Tim Bunce wrote: >On Wed, Jan 09, 2002 at 04:42:51PM +0000, Graham Barr wrote: > > On Tue, Jan 08, 2002 at 06:38:02PM -0500, Dan Sugalski wrote: > > > ># Attributes are done as a hash of hashes. Each interpreter has a > > > ># pointer to an attribute hash, whose keys are the attribute names. The > > > ># values will be hash pointers. Those hashes will each have a key which > > > ># is a PMC pointer (hashed up somehow) and the value is the attribute > > > ># value. > > > > > > > >If you're talking about 'is'-style attributes, why not have them be > > > >attached to the PMCs themselves? > > > > > > D'you want an attribute pointer for each PMC? (I've considered it, > but for > > > the moment I think it'll be too expensive. Might be wrong) > >This sounds rather like perl5's optional list of arbitrary 'magic'. >Can't PMC's be 'upgraded' so only carry the overhead if needed?
Not easily. PMC structs are fixed size, unlike perl's variable-size SVs. I was hoping to keep attributes as OOB data, since I'm not sure it'll be used enough to be worth being in-band. However... > > On the other hand when a variable is garbage collected you have to walk > the hash > > of hashes to clear out the attributes. Also what happens when you move > the PMC > > during garbage collection, will the key in the hash change ? > >Good points. This is a darned good point. Good enough to dump my OOB argument, I think. > > A PMC may have a flag to show if it has any entries in the global table, > > but it is probably just a trade off between space and performance. > >Tim [who's not really been paying attention, so ignore me if I'm being daft]. Nah, you're making sense. Besides, vtables are all your fault in the first place, so I ought to be listening... :) Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk