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

Re: [PATCH] core-only patch for clamp/readonly hashes

Thread Previous | Thread Next
Nick Ing-Simmons
November 1, 2001 06:52
Re: [PATCH] core-only patch for clamp/readonly hashes
Message ID:
Nicholas Clark <> writes:
>On Thu, Nov 01, 2001 at 12:50:43PM +0000, Nick Ing-Simmons wrote:
>> Graham Barr <> writes:
>> >So why make exists an exception to the rule ? Surly people can mistype
>> >the element name passed to exists just as easily.
>> My view is that exists isn't a special case - I said:
>>  >exists $hash{baz};  # error - not an allowed key
>Don't we want enough flexibility (and flags) to allow both behaviours?

You mean in addition to eval { exists $hash{'baz'} } ?
I don't think it is worth the hassle.

If these things are mainly for struct-oids then code is supposed to know
what the keys are.

>If exists is a warning on not allowed keys then passing a reference to one
>of these restricted hashes into older code not specifically expecting one
>could start making warnings appear which cry wolf.

Which is quite valid given that we just sent it a lupine hash ;-)
If the code isn't expecting one it is just as likely to try and
add/delete a non-allowed key.
(If the code is expecting a child friendly beagle and is used to pulling
its tail then sending it a wolf to play with is asking for trouble.)

>But if exists is not a warning then typos will be missed.
>Nicholas Clark
Nick Ing-Simmons

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About