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

Re: [PATCH for discussion] clamp, round #2

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
August 1, 2001 03:31
Subject:
Re: [PATCH for discussion] clamp, round #2
Message ID:
20010801103125.1751.3@bactrian.ni-s.u-net.com
Jeffrey Friedl <jfriedl@yahoo.com> writes:
>Nick Ing-Simmons <nick@ing-simmons.net> wrote:
>|> The completeness of your patches is a joy, but IMHO:
>
>Thanks
>
>|> while it is now using SvREADONLY it is _still_ adding 
>|> the SVh_CLAMP_ACCESS flag which was what the SvREADONLY proposal 
>|> was supposed to avoid.
>
>I did so to support the ability to clamp access, which as far as I can tell
>does require another bit. Being readonly and having access clamped are
>really orthogonal (a fancy way to say "unrelated" :-), so I don't see a way
>to implement them both with one bit.

I seem to be missing something here. I agree they are orthogonal, and need 
more than one bit. I am proposing that a "read only hash with N members"
uses N+1 bits and a "clamped hash" uses 1 bit - thus:

A. Setting "the" bit on the HV to say "keys are fixed" (i.e. clamp).
B. Setting "the" bit on the SVs that are the values to say "cannot change value".

So a clamped hash just has the bit set on the HV.
A fully readonly hash has the bit set on the HV and on all the values.
As each entity only needs one bit existing SvREADONLY bit can be used.

Can you please explain what semantic that implementation lacks compared
to yours?

Then explain why this cannot be done with 'magic' ;-)




-- 
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