Uri Guttman <[EMAIL PROTECTED]> writes:

>>>>>> "SC" == Simon Cozens <[EMAIL PROTECTED]> writes:
>
>   SC> [EMAIL PROTECTED] (Damian Conway) writes:
>   >> > 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.
>
>   SC> So, uhm, what *does* happen if I do
>
>   SC> $hash{$pair} = "foo";
>
>   SC> Runtime error? And what if I do this:
>
>   SC>    my %hash is keyed(REF);
>   SC>    $hash{bless $pair, "NotAPairReally"} = "foo";
>   SC>    ...
>   SC>    for %hash.kv -> ($k, $v) {
>   SC>        bless $k, "PAIR";
>   SC>    }
>
>   SC> Storing pairs as hash keys could lead to interestingly funky data
>   SC> structures.  I'm sad that this is being ruled out.
>
>
> i don't think he said that is ruled out. it is not the default
> behavior. i think if you declared it as keyed(PAIR) it would do what you
> want.

But that implies that *all* the keys will be pairs. Which is
(emphatically) not necessarily the case.

-- 
Piers

   "It is a truth universally acknowledged that a language in
    possession of a rich syntax must be in need of a rewrite."
         -- Jane Austen?

Reply via email to