Uri Guttman wrote:
> but what simon was saying (and i agree) is the the pair IS a single
> item. it becomes the key and its value is 'scalars'.
No. If it's a PAIR, then its key is the key and its value is the value.
> hashes can now take objects as keys and won't just stringify them.
Correct. But I believe that's only if the hash has a property that marks
its keys as being objects, not strings:
my %hash is keyed(REF);
And, even if that's the default, it still oughtn't apply to PAIRs.
To get keys that are PAIRs, you should have to say:
my %hash is keyed(PAIR);
> @array = ( key => 1, key2 => 3, 4, 5 ) ;
> %hash = @array ;
>
> what does that do? 3 pairs in the hash or 2 (the first pair is the key
> for the second pair)?
Three. As above. You'd get:
%hash{'key'} = 1;
%hash{'key2'} = 2;
%hash{'4'} = 5;
> it comes down to how much perl6 will look inside the list data assigned
> to a hash. will it scan items and handle pairs specially
Yes.
> or just act like they are 1 item?
No.
> and i like pairs a lot. they make the => into something very useful and
> not just sugar. but i think the handling of pairs in hash assignment is
> still not on solid ground.
It is. It's just that that grounding has evidently not been adequately
communicated yet.
> there needs to be some semantic way to select the hash assignment style
C<is keyed()>
> and a proper definition of the default style.
See above.
And my other post on this topic.
Damian