develooper Front page | perl.perl5.porters | Postings from December 1999

Re: Extra Scalar member of GVs for methods

From:
Nick Ing-Simmons
Date:
December 20, 1999 07:24
Subject:
Re: Extra Scalar member of GVs for methods
Message ID:
199912201523.PAA17688@tiuk.ti.com
Tim Bunce <Tim.Bunce@ig.co.uk> writes:
>On Mon, Dec 20, 1999 at 02:10:54PM +0000, Nick Ing-Simmons wrote:
>> 
>> While debugging SV leakage in Tk I noticed that when GVs are dropped
>> into derived class package to represent the "inherited" methods
>> the GVs have their SV slot filled in with a NULL SV.
>> 
>> Is this either necessary or useful? 
>> When you have a system like Tk with lots of inherited methods
>> having $Tk::Text::destroy created when you call $text->destroy
>> means quite a few SVs get called into being never to be used.
>
>I recall Larry saying that all GVs get an SV for free.

Hmm, that is a strange sense of 'free' - all GVs are taxed by one SV ;-)

The mandatory SV is indeed there in gv_init(). 
This means I have $ISA $STDOUT $_/usr/local/lib/perl5/base.pm and
all kinds of such garbage. 

This was presumably to avoid the extra 
test so that GvSV was quicker than GvAVn - but this is of less value
now that "most" scalar vars are presumed to be lexical.

>Maybe that's no longer the win it as presumed to be.
>
>Tim.
-- 
Nick Ing-Simmons <nik@tiuk.ti.com>
Via, but not speaking for: Texas Instruments Ltd.




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