Dale Fredrikson
2008-10-06 12:29:28 UTC
As far as I can tell, the removeKey() function of the assocArray object doesn't work properly.
To demonstrate what I'm talking about, please compile and run the following code:
local a
a = new assocArray()
a[ 'one' ] = 'the number one'
a[ 'two' ] = 'the number two'
a[ 'three' ] = 'the number three'
a[ 'four' ] = 'the number four'
a[ 'five' ] = 'the number five'
a.removeKey( 'three' )
inspect( a )
If you then drill down in the Inspector to the Array Elements, it should show the four remaining elements -- everything except 'three'.
But it doesn't. Instead it shows that 'three' has indeed been removed, but also one of the other elements has been modified: For that element, the key value has been removed, and the element value has been set to false.
Maybe this is old news, but I don't find anything about it in bug_reports.
Am I missing something obvious?
Dale
To demonstrate what I'm talking about, please compile and run the following code:
local a
a = new assocArray()
a[ 'one' ] = 'the number one'
a[ 'two' ] = 'the number two'
a[ 'three' ] = 'the number three'
a[ 'four' ] = 'the number four'
a[ 'five' ] = 'the number five'
a.removeKey( 'three' )
inspect( a )
If you then drill down in the Inspector to the Array Elements, it should show the four remaining elements -- everything except 'three'.
But it doesn't. Instead it shows that 'three' has indeed been removed, but also one of the other elements has been modified: For that element, the key value has been removed, and the element value has been set to false.
Maybe this is old news, but I don't find anything about it in bug_reports.
Am I missing something obvious?
Dale