﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
3948	"Map object: keys [0] and [""[""] clash"	Simon E. <autoitscript.com@…>	Jon	"Hi team,

I realise that map objects are experimental and bug reports are not wanted, but I just thought I'd record this here in case anyone is interested.

When a map object contains a key of `0` and a key of `[` these seem to clash in some way and tend to overwrite each other. But somewhat intermittently. 

Here's an example script:

{{{#!autoit
Local $map[]

$map[""a""] = 1
$map[""0""] = 2
$map[0]   = 3
$map[""[""] = 4

ConsoleWrite($map[""a""] & @CRLF)		; expecting 1
ConsoleWrite($map[""0""] & @CRLF)		; expecting 2
ConsoleWrite($map[0]   & @CRLF)		; expecting 3, but sometimes prints 4
ConsoleWrite($map[""[""] & @CRLF)		; expecting 4

$map[0] = 5

ConsoleWrite($map[0]   & @CRLF)		; expecting 5
ConsoleWrite($map[""[""] & @CRLF)		; expecting 4, but sometimes prints 5
}}}

When running this script, I would expect the console to show:

{{{
1
2
3
4
5
4
}}}

This happens intermittently, on about 40% of executions. On the other 60%, I get this result instead, where any assignment to `$map[0]` and `$map[""[""]` ends up overwriting each other:

{{{
1
2
4
4
5
5
}}}

I suspect that somehow, internally, `0` and `[` are assigned the same value, resulting in the clash.

I uncovered this while trying to create a map of various characters and their binary representations. One workaround is to ensure the keys are all strings, and not use integer keys. It was a confusing bug for a while, though."	Bug	assigned		AutoIt	3.3.16.1	None		maps, keys	
