develooper Front page | perl.perl5.porters | Postings from October 2001

Re: Clamp, wherefor art thou

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
October 30, 2001 13:10
Subject:
Re: Clamp, wherefor art thou
Message ID:
20011030210926.669.4@bactrian.ni-s.u-net.com
Jeffrey Friedl <jfriedl@yahoo.com> writes:
>|> Arthur Bergman <arthur@contiller.se> writes:
>|> >
>|> >> So we have the semantics defined for the existing SvREADONLY bit,
>|> >> we allow HE/Nullsv for allowed-but-not-existing.
>|> >> (I assume that delete $hash{'foo'} for a %hash with SvREADONLY
>|> >> leaves the HE and sets its SV * to Nullsv as proposed.)
>|> >>
>|> >
>|> >Or we add this to the core. It would be a rather small addition.
>|>
>|> I am would be quite happy if patches to implement above were applied.
>|> I will even add it to my todo queue if noone else gets there first.
>
>I'm a little confused by this part of the thread, since this is *exactly*
>what the patch I submitted does (except that I use PL_sv_undef instead of
>Nullsv, since you'll find that using Nullsv will get you into a lot of
>troubles.)

The patch you sent earlier today does other stuff.
In particular it is still using the extra flag (with the muddling name):

+#define HvCLAMPEDACCESS(hv)	(SvFLAGS(hv) &   SVh_CLAMP_ACCESS)

and the extra slot:

+	    xhv->xhv_realkeys++; /* HvREALKEYS(hv)++ */

The changes Arthur and I "agreed" to don't require either.

Our proposal is a hash which has SvREADONLY(hv) true has its keys fixed.
There are no extra slots in the HV and hence no increments of them.

An array with SvREADONLY(av) true will not grow/shrink from its existing size
but "empty" members can be filled in.

If you care to submit a patch which just touches core files and implements
above I will review and apply it (fitting in round PerlIO fixups).
If the patch adds other files (other than tests), or fails to update 
diags etc. then it will take longer to integrate and I reserve the 
right to re-implement it myself...


-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/


Thread Previous | Thread Next


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