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

Re: [PATCH for discussion] new feature: clamp %hash

Thread Previous | Thread Next
From:
Tim Bunce
Date:
July 20, 2001 15:45
Subject:
Re: [PATCH for discussion] new feature: clamp %hash
Message ID:
20010720234453.A2430@ig.co.uk
On Fri, Jul 20, 2001 at 09:09:56AM +0100, Nick Ing-Simmons wrote:
> Jeffrey Friedl <jfriedl@yahoo.com> writes:
> >[non-list reply]
> >
> >Nick Ing-Simmons <nick@ing-simmons.net> wrote:
> >|>  - why do we need new flag rather than SvREADONLY ?
> >
> >As I mentioned in the original post, clamping is different from readonly. 
> >It seems to me that a readonly hash would mean that no changes would be
> >allowed at all, including to its values.
> 
> The writability of the values could/should be controlled by the 
> SvREADONLY bit of the value SVs.
> 
> Thus to get "clamp" just set flag on HV, to really lock it down
> set it on the values then set on HV.
> 
> 
> >(Which would be a nice feature as
> >well, and even moreso, it would imply that we could then have readonly
> >scalars.)
> 
> We can already. What is needed is an interface - as a module ;-)
> 
> I am willing to put hooks into the core to get croaks when 
> a READONLY hash is accessed.
> 

FWIW, I agree with Nick entirely.

Tim.

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