In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/cc25b9e2d291fedac80973dc493e321d31d3cb1a?hp=1cafb023c42b2724c2d2fe32a64b6fe43fe7f0c2>
- Log ----------------------------------------------------------------- commit cc25b9e2d291fedac80973dc493e321d31d3cb1a Author: David Mitchell <[email protected]> Date: Thu Nov 24 14:42:27 2016 +0000 add comments explaining the point of SVf_PROTECT The flag was added by v5.21.4-17-ga623f89, but outside of the commit message itself, there didn't seem to be any explanation for this flag. ----------------------------------------------------------------------- Summary of changes: sv.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sv.h b/sv.h index 7808b89..ee65879 100644 --- a/sv.h +++ b/sv.h @@ -374,6 +374,15 @@ perform the upgrade if necessary. See C<L</svtype>>. subroutine in another package. Set the GvIMPORTED_CV_on() if it needs to be expanded to a real GV */ + +/* SVf_PROTECT is what SVf_READONLY should have been: i.e. modifying + * this SV is completely illegal. However, SVf_READONLY (via + * Internals::SvREADONLY()) has come to be seen as a flag that can be + * temporarily set and unset by the user to indicate e.g. whether a hash + * is "locked". Now, Hash::Util et al only set SVf_READONLY, while core + * sets both (SVf_READONLY|SVf_PROTECT) to indicate both to core and user + * code that this SV should not be messed with. + */ #define SVf_PROTECT 0x00010000 /* very read-only */ #define SVs_PADTMP 0x00020000 /* in use as tmp */ #define SVs_PADSTALE 0x00040000 /* lexical has gone out of scope; -- Perl5 Master Repository
