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

Re: Hash::Util and read-only values

Thread Previous | Thread Next
From:
demerphq
Date:
September 20, 2014 04:47
Subject:
Re: Hash::Util and read-only values
Message ID:
CANgJU+XDgqM+OEnVzxL0qLzaZXkdcRd8aT_gKQ46ErOHrYVCRQ@mail.gmail.com
On 20 September 2014 06:30, 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))
>
>
Ah right. Ok.


> and SvREADONLY_on/_off only flip the SVf_READONLY flag #ifndef
> PERL_CORE.
>
>
Yeah that works. Does universal.c get compiled with PERL_CORE enabled?

Also, I wonder if any important modules define that. I know in Sereal we
copied some code from core to avoid using it[1], and I wonder how many
people have done the opposite. Which then makes me think of the madness of
creating more defines... Imagine PERL_CORE_REALLY and
PERL_CORE_NO_SERIOUSLY_I_MEAN_IT. :-)

Yves
[1]
https://github.com/Sereal/Sereal/blob/master/Perl/Decoder/srl_decoder.h#L87
-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

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