On Wed, Aug 8, 2012 at 11:23 AM, kortschak
<
dan.ko...@adelaide.edu.au> wrote:
> This is something I've found interesting. It's one place where a significant
> amount of magic is displayed; (nearly) everywhere else, one run can be
> guaranteed to be identical to another down to variable address allocation,
> but there is no way to enforce identity on map key retrieval order. This
> hasn't caused any problems, but it does seem kind of odd in the context of
> most other design choices (that's not to say the motivation is unclear).
The spec says that maps are unordered which gives the implementation
of maps far more flexibility in terms of performance.
Map behaviour in the gc implementation of Go was fairly predictable
because it didn't exploit the fact that the spec defines it as
unordered.
This caused problems because developers started writing code that
relied on maps being ordered (because in this implementation they
were).
Changes where made to add additional randomness to the map
implementation just to prevent programmers from relying on
implementation specific behaviour.
--
=====================
http://jessta.id.au