On 28 January 2017 at 16:43, Leon Timmermans <fawaka@gmail.com> wrote: > On Sat, Jan 28, 2017 at 3:31 PM, demerphq <demerphq@gmail.com> wrote: >> >> My experience with locked hashes is that as currently implemented they >> are nearly useless. A simple read of a non-existent key becomes a >> fatal exception, which makes them nearly unusable in conventional >> code. At work we have tried to use them for a few purposes, and >> generally it is has been a failure. They impose a run time penalty on >> all hash access even though they are barely used. > > As far as I know they're only used in the fields implementation, and were > introduced when pseudohashes were abolished. I believe readonly hashes are > generally far more useful, and that fields can be implemented quite easily > on top of a pluggable hash API. Agreed. And in the cases we have at $work we are using them for their read-only'ness not their lockedness. (The difference is subtle. A read only hash would allows one to read a nonexistent key without throwing an exception. A locked hash throws an exception when you try to access a key that was not known at the time of locking.) Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"Thread Previous | Thread Next