develooper Front page | perl.perl6.language | Postings from September 2000

Re: proto-RFC: keys(HASH) as lvalue (was Re: RFC 179 )

Thread Previous | Thread Next
From:
Bart Lateur
Date:
September 1, 2000 09:44
Subject:
Re: proto-RFC: keys(HASH) as lvalue (was Re: RFC 179 )
Message ID:
81nvqss0f1clicuckkesu0e35g27fliu42@4ax.com
On Fri, 1 Sep 2000 10:23:27 -0400, John Porter wrote:

>>     keys %HASH = LIST;
>> 
>> is really
>> 
>>     @HASH{ LIST } = ();
>
>Sure.  Would you have any great objection to adding the alternative syntax?

I have some doubts. See perlfunc -f keys, from which I quote:

     If you say

        keys %hash = 200;

     then `%hash' will have at least 200 buckets allocated for
     it--256 of them, in fact, since it rounds up to the next power
     of two.

So, in summary: with this new syntax, you cannot safely distinguish

	keys %hash = 200;

from

	$hash{200} = undef;

-- 
	Bart.

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