On 14.04.2011 11:04, Stéphane Ducasse wrote:
Hi igor
this is strange I have a dictionary whose array contains nil and still
isHealthy returns true.
can an array of a dictionary contains nil?
no, it can't .
And how you end up with dictionary which having array = nil? During
initialization, it allocates and initializes array,
so, normally, there is no way how it could be nil.
Ehm, the array can _contain_ nil(the empty slot marker) (and it will in all
cases, if it's working correctly), it cannot _be_ nil though.
isHealthy has nothing to do with this though, it checks if all elements
(non-nil entries in the array) are at positions which are valid.
\
Err.. maybe i misunderstood?
i meant
dict array == nil
should not happen, but
(dict array at: someindex ) == nil
is quite normal.
I do not know I have a do: loop and some elements are nil and break the loop.
Stef
do: iterates the values in the Dictionary, and yes, it's perfectly valid
to have a pair someKey -> nil in the dictionary.
Why you have it (ie who put it there), and if it should be valid in your
case, you'd have to figure out :)
Cheers,
Henry