[Swift-devel] Associative arrays: foreach index issue.

Yadu Nand yadudoc1729 at gmail.com
Fri Jun 24 14:20:28 CDT 2011


Hi Mihael,

> We've established that any random id is as bad as a sequential id. So
> use the thread index instead if you really want this. But I think we
> also established that we don't really need implicit indices.

So, the UUID approach is not right/preferable. I'm sorry I didn't understand
much from the earlier mail thread, and went on thinking its ok as long as
the index is unique.

>From the earlier thread you proposed using thread prefixes for array indices,
should I try that ? Or is there a way to avoid indices altogether ?

> That's random an ugly. We should use the exact type for declarations:
> int array[string].
>
>> 2. Or simply modify the foreach syntax to accommodate string
>>      indices. Leaving the following style
>>      foreach value, string:index in array["key"] {
>>         // do work
>>      }

> And what happens if there is a mismatch between the foreach index type
> and the array type?
I don't understand, why would that matter as long as we know the types of
each ?

> Point being that we can use type inference to figure out the type of the
> index since we know the type of the array key.

-- 
Thanks and Regards,
Yadu Nand B



More information about the Swift-devel mailing list