Darren Duncan wrote:
> pugs-comm...@feather.perl6.nl wrote:
>> Log:
>> [S02] clarify that Pairs and Mappings are mutable in value, but not in key
> <snip>
>>     KeyHash     Perl hash that autodeletes values matching default
>>     KeySet      KeyHash of Bool (does Set in list/array context)
>>     KeyBag      KeyHash of UInt (does Bag in list/array context)
>> +    Pair        A single key-to-value association
>> +    Mapping     Set of Pairs with no duplicate keys
> <snip>
>> +As with C<Hash> types, C<Pair> and C<Mapping> are mutable in their
>> +values but not in their keys.  (A key can be a reference to a mutable
>> +object, but cannot change its C<.WHICH> identity.  In contrast,
>> +the value may be rebound to a different object, just as a hash
>> +element may.)
> Following this change, it looks to me like Mapping is exactly the same as
> Hash.  So under what circumstances should one now choose whether they want
> to use a Hash or a Mapping?  How do they still differ? -- Darren Duncan

I don't think they do.  IMHO, Mapping should definitely be immutable
in both key and value; it is to Hash as Seq is to Array.  (Side note:
why is List considered to be immutable?  Doesn't it change whenever
its iterator is read?)

The question in my mind has to do with Pair: if Pair is being
redefined as mutable in value, should it have an immutable
counterpart?  If so, what should said counterpart be called?

Jonathan "Dataweaver" Lang

Reply via email to