[Swift-devel] Associative array in Swift [GSoC]
Mihael Hategan
hategan at mcs.anl.gov
Sat Jun 18 19:42:26 CDT 2011
On Sun, 2011-06-19 at 00:15 +0000, Ben Clifford wrote:
> > Use the size of the array at the time of the append.
>
> might introduce non-deterministic behaviour when used with restarts when
> the index is used later
Fair point.
> (for example, to determine a filename) as the
> index is then a race-based random number, I think. That's what I was
> getting at with my comment about how things were done in the past with
> restarts: I think that its possible to make restart-proofed identifiers
> that look something like a combination of the position in the source file
> combined with an index for any containing code that causes the same source
> text to be executed multiple times (eg. each time you have a foreach,
> stick the index onto the end of the identifier; each time you call a
> function, stick the source position of the call onto the end of the
> identifier).
So then the index would be the thread index. I think that might work.
More information about the Swift-devel
mailing list