[prev in list] [next in list] [prev in thread] [next in thread]
List: perl5-porters
Subject: SV: [PATCH] core-only patch for clamp/readonly hashes
From: "Arthur Bergman" <arthur () contiller ! se>
Date: 2001-10-31 20:38:45
[Download RAW message or body]
> > >+=item Can't access nonexistant key {%s} of readonly/clamped hash
> >
> > That "clamped" word has IMHO got to go ...
>
> How about "restricted"?
>
> > frozen makes a little more sense perhaps but I am still unclear what the
> > specification is. Author and I yesterday described what semantics
> > of SvREADONLY would be. We did not describe what "frozen" would be.
> > I still don't understand the semantics of "frozen".
> >
> > Please describe the semantics of "frozen" (don't used the clamped word)
> > explaining how it differs from READONLY.
>
> If I got it right: at the moment of "restricting" the hash the keys
> that exist become the only allowed keys. No new elements with new
> keys can be added. Existing elements can be deleted, though (and
> there the "magic marker" is used), and the elements can be added back.
>
> This is a subset of READONLY, in that with READONLY *no* changes
> are allowed.
>
> add delete add delete access
> old old new new
> READONLY - - - - +
> restricted + + - - +
> normal + + + + +
>
> --
> $jhi++; # http://www.iki.fi/jhi/
> # There is this special biologist word we use for 'stable'.
> # It is 'dead'. -- Jack Cohen
>
I disagree.
my $foo = \$foo{"foo"} is reason enough not to have a flag on a hash to set its scalars to readonly;
To do that we need to itirate the hash and turn them on readonly.
I agree with Nick here I think.
SvREADONLY on a hash makes it impossible to add or delete keys
keys returns all keys
exists returns false on keys wich are PL_sv_undef
This can be implmented with minimal fuss and minimal checks in the core.
Arthur
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic