[Swift-devel] Problem with iterate

Ben Clifford benc at hawaga.org.uk
Thu Feb 18 17:19:14 CST 2010



> But I don't get it, how can the variable b not have a value, if it is consumed
> by cat() in a prior statement?

Its not prior in execution order; its prior in source text, which does not 
imply execution order.

If I write (in maths, not in a program) this system of simultaneous 
equations:

x = y + 1
y = x + 1

then there is no solution giving values for x and y. Whats happening there 
is fairly close to what Mihael's example was (but saying +1 instead of 
cat, and using integers).

> I thought Swift followed a write-once read many
> paradigm, which was enforced by the single assignment paradigm.

yes (apart from arrays, which are monotonically assigned so have most of 
the same properties as single assignment variables)

> I guess there is a
> distinction between files and variables?

Variables hold "things". Those things can be in-memory values, or they can 
be files. But for this discussion the distinction doesn't matter - the 
file/in-memory value stuff is orthogonal to the data-directed execution.

-- 



More information about the Swift-devel mailing list