I think the easy access to user defined immutables in Julia would make a great argument for disallowing mutable keys. It's an unfortunate choice to make tough, because it is a pure restriction that makes some problems harder to solve. It also seems somewhat costly in implementation (because we need to check a new recursive immutable property). The result will be that lots of users gets a error about mutable keys, instead of a KeyError only when the key changed.
We could make a copy on insertion, but that would require us to also take a copy before iterating on the keys as well. That would create lots of temporary copies, that Julia currently doesn't have the infrastructure to optimize away. Ivar kl. 19:12:37 UTC+2 mandag 13. oktober 2014 skrev Stefan Karpinski følgende: > > Yeah, there's no ideal solution. Python disallows mutable keys; Ruby > allows them and has the same behavior as Julia here; Perl turns all keys > into strings (I think that string keys may still be mutable in Perl, but > it's become so hard to get a readline-enabled prompt in Perl, that I gave > up on checking). > >> >> >
