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

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

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
July 20, 2001 01:11
Subject:
Re: [PATCH for discussion] new feature: clamp %hash
Message ID:
20010720080956.708.6@bactrian.ni-s.u-net.com
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.

You are not getting a new keyword 



>
>	Jeffrey
-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/


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