Talk:Associative array/Iteration: Difference between revisions

they '''should''', since often it's useful
(Task is clarified)
(they '''should''', since often it's useful)
Line 12:
 
:::::: Why do you think so? There might be no efficient or safe way to iterate an associative array. Consider an implementation that stores the array in an external storage. An implementation may deliberately disallow iteration for performance reasons, like a lock-free associative array could do, for instance. But I see that now the task is so diffusely stated, that anything would fit it! (:-)) --[[User:Dmitry-kazakov|Dmitry-kazakov]] 10:04, 5 August 2009 (UTC)
 
::::::: I think so since every language I know provides a way of iterating an "associative array", by pairs or giving back an array of keys and since it is often implemented because it's something one may need, often enough (and in fact, a lot of people use iteration over associative arrays alot in everyday programming). Currently I am using the [[:Category:Judy]] library to associate a data structure with a "symbol"; I am not interested in a way of iterating over the associations since the only intention is just to retrieve the data given the symbol, and this library itself does not provide a way of doing such an iteration over the associations. But if I were writing a language, I would implement for sure a way of iterating over it (it can be just extra memory, no killing performance too much: just another operation to keep track of the created "symbols"/keys). It does not mean that every language has it of course, but it's my opinion that if a language has associative arrays, it must give a way of iterating over them, since, as said, it's often useful. And my current knowledge of (high level) languages confirm this. --[[User:ShinTakezou|ShinTakezou]] 13:52, 5 August 2009 (UTC)