develooper Front page | perl.perl5.porters | Postings from September 2014

Re: Hash::Util and read-only values

Thread Previous | Thread Next
From:
Reini Urban
Date:
September 20, 2014 15:10
Subject:
Re: Hash::Util and read-only values
Message ID:
CAHiT=DEhE9GVdJTAPtgNm3kwRYmguMrtpyCVfhWBrzt6ehh6Gw@mail.gmail.com
On Fri, Sep 19, 2014 at 11:30 PM, Father Chrysostomos <sprout@cpan.org> wrote:
> Yves Orton wrote:
>> I think we could add a new bit "locked", and then make SvREADONLY() use it.
>> That would be a reasonable fix. But again it doesnt require changing
>> Hash::Util at all. It requires changing universal.c XS_Internals_SvREADONLY
>
> We also have CPAN modules fiddling with SvREADONLY.  So I think the
> real solution is:
>
> #defined SvREADONLY(sv) (SvFLAGS(sv) & (SVf_READONLY|SVf_PROTECTED))
>
> and SvREADONLY_on/_off only flip the SVf_READONLY flag #ifndef
> PERL_CORE.

I don't like this. SvREADONLY should be the interface to
readonly-ness, and not a combination thereof.

To lock hash keys and hash values you simply unify the Hash::Util lock
keys and values API, and store the locked bit in the HE.
There's enough room there, but there's no room in the SV, and changing
the meaning of SvREADONLY again (with FAKE finally gone now)
is problematic.

-- 
Reini Urban
http://cpanel.net/   http://www.perl-compiler.org/

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