develooper Front page | perl.perl5.porters | Postings from April 2006

Re: add svt_local slot to magic vtable

Thread Previous
From:
Dave Mitchell
Date:
April 28, 2006 16:20
Subject:
Re: add svt_local slot to magic vtable
Message ID:
20060428232056.GB2688@iabyn.com
On Fri, Apr 28, 2006 at 03:49:23PM +0100, Nicholas Clark wrote:
> I realise that I've just integrate this to maint as-is, and that we've already
> released these flags as 5.9.3 to CPAN, and that we missed the first chance
> with MGf_DUP, but I was wondering:
> 
> Given that you can't have a MGf_LOCAL entry without already having a MGf_DUP
> entry, would it make sense to conserve the limited supply of flag bits by
> using 0x10 for DUP, 0x20 for DUP+LOCAL and 0x30 for DUP+LOCAL+the_next_one
> 
> Alternatively, would it make some sense to add a flags word to the vtable
> after DUP, so that future stretching of the vtable can be done without eating
> into flags bits?

My reading of K&R 2nd Ed is that any struct initialiser that doesn't
contain enough elements initialises the remaining elements to 0.

So we could just have a single flag that says "I promise that this vtable
has been initialised using only an '= {...}' or a 'Copy(..., struct mg)'
and therefore any new fields that I don't know about, you just need to
check for non-nullness".

Althought the _LOCAL flag is now in the wild, it was documented as being
only for the use of threading and wildly subject to change, so I certainly
think we could reclaim that flag.

Whether we could claw back _DUP and _COPY as well, I don't know. Until
very recently, those two flags and the associated fields were totally
undocumented, and were only used, within the core, for threads::shared.

> I can see that it might be nice to have a bless vtable entry, because right
> now as I understand it, blessing a shared object can't work, as there's no
> way to signal to the bless code to do something extra.
> 
> Although I'm not sure how useful this is with shared objects, because if
> thread A blesses a shared object, thread B's local proxy never gets to learn
> about it.

My, we are behind the times, aren't we? :-) Since 5.8.1 you've been able to
bless shared arrays and hashes, and since 5.8.8, bless shared scalars.
With the objectness being seen by other threads.

-- 
In England there is a special word which means the last sunshine
of the summer. That word is "spring".

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About