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

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

Thread Previous | Thread Next
From:
Arthur Bergman
Date:
July 20, 2001 00:35
Subject:
Re: [PATCH for discussion] new feature: clamp %hash
Message ID:
B77DABB1.2604%arthur@contiller.se
01-07-20 02.35, skrev schwern@pobox.com på schwern@pobox.com 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.

-- 
Arthur


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