[Swift-devel] Associative array in Swift [GSoC]

Mihael Hategan hategan at mcs.anl.gov
Sat Jun 18 15:20:31 CDT 2011


On Sat, 2011-06-18 at 22:51 +0530, Yadu Nand wrote:

> As you might have guessed from the output, whenever I see
> a "!" string as a subscript I used a random function to generate a random key.

Use the size of the array at the time of the append. That's guaranteed
to be unique (as long as both the actual append and the size() call are
in the same critical section).

> This might be bad as there is no guarantee that there will be no collision.
> I'm trying to replace this with a UUID so that no-collisions can be guaranteed.





More information about the Swift-devel mailing list