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

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

Thread Previous | Thread Next
Arthur Bergman
July 20, 2001 00:35
Re: [PATCH for discussion] new feature: clamp %hash
Message ID:
01-07-20 02.35, skrev på följande:

>> |> clamp() unfortunately violates this.  You have to put all your keys in
>> |> the hash before clamping it, so there's effectively no way to
>> |> distinguish between a valid key which has not been set yet and a valid
>> |> key which is set to undef
>> exists()
> Here's the problem.  How can I have a clamped keyset of 'foo' and
> 'bar' where C<exists $clamped_hash{foo}> is false?

Is this realy a problem, a clamped keyset is all keys in the set, if foo is
in the set it will return true on exists, otherwise false. What you want to
do is to have a prototype for a hash with the keys, that is much slower
since we have to compare against that prototype, and that is the same has
dealing with pseudohashes.


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