Are Restricted/Locked Hashes A Failed Experiment?

Some time back we added support to Perl for locked or restricted hashes. (See Hash::Util and The basic idea is that you can set up a hash, and then "lock" it, at which point access to unregistered keys in the hash, either write OR read, will cause an exception.

The basic idea was to work around Perl's lack of a true "struct"/"object" where it would be conventional to have compile time exceptions when accessing a non-existent member, or when accessing a late bound object in many languages which should produce a run time exception. Unfortunately restricted hashes do not supp…

About demerphq

user-pic Perl core hacker, former Principal Dev and Fellow at You can blame me for hash randomization, and for much of the new regex syntax since 5.10.