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

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

Thread Previous | Thread Next
From:
schwern
Date:
July 19, 2001 17:36
Subject:
Re: [PATCH for discussion] new feature: clamp %hash
Message ID:
20010719203558.D28254@magnonel.guild.net
On Thu, Jul 19, 2001 at 05:03:39PM -0700, Jeffrey Friedl wrote:
> schwern  <schwern@pobox.com> wrote:
> |> On Thu, Jul 19, 2001 at 11:15:12AM -0700, Jeffrey Friedl wrote:
> |> > I added a new reserved word (I can hear the cringing already) "clamp".
> |> 
> |> Here's my thoughts about any new attempt to replace pseudo-hashes,
> 
> My thought of clamp has never been that they are somehow a replacement for
> pseudo-hashes. They're sort of apples and oranges (although both are orbed
> fruits).

I'm worried about spawning multiple half-way solutions to the problem
and sticking them into the core.


> Since you can unclamp (or declamp, or whatever) something, it doesn't
> provide security or anything.

The declamping feature is actually very nice.


> |> 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?


-- 
Michael G Schwern   <schwern@pobox.com>   http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <perl-qa@perl.org>       Kwalitee Is Job One

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