develooper Front page | perl.perl5.porters | Postings from November 2003

Re: 5.8.2 coredump: tied hashes implemented as XSUB methods

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
November 19, 2003 03:57
Subject:
Re: 5.8.2 coredump: tied hashes implemented as XSUB methods
Message ID:
20031119114817.2752.14@llama.elixent.com
Alan Burlison <Alan.Burlison@sun.com> writes:
>Nicholas Clark wrote:
>
>> IIRC (confirmed by looking at hv.c)
>> 
>> SvREADONLY on the hv makes the hash a restricted hash
>> (can't add new keys, can't access keys not present, can delete keys)
>
> From looking at my test script, in 5.6.1 it looks like readonlyness on a 
>hash only prevented you from deleting, not from adding new keys.
>
>> SvREADONLY on a key also prevents it from being deleted.
>> 
>> (as well as the regular effects of readonlyness)
>
>Umm, what exactly do you mean by 'regular'?  Surely deletion is the only 
>thing you can do to a hash key anyway?  

He meant values not keys 

    $foo{Fred} .= "Junk";

is 'regular' effect of marking values readonly.


>Do you mean it also makes the 
>associated value readonly, or would that have to be set seperately?
>
>> I think that the implementation should have been marked "subject to change"
>> as it's not that clean.
>
>As well as the fact that it breaks existing code :-(  FYI, the module in 
>question is Sun::Solaris::Kstat, used by the Solaris-specific /bin/kstat 
>command.  It's more than a little inconvenient that this is broken between 
>5.6.1 and 5.8.2, as I have to ship both perl versions in Solaris 10.
>
>When 'restricted hashes' were added did anyone check that XSUB code which 
>uses them still behaves sensibly on older versions of perl?  You always 
>could SvREADONLY_on/off on hashes in 5.6.1, it's unfortunate that the 
>restricted hashes stuff has broken older code.
>
>-- 
>Alan Burlison


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