[Swift-user] Re: [Swift-devel] Problem with iterate
Ioan Raicu
iraicu at cs.uchicago.edu
Fri Feb 19 10:48:56 CST 2010
But assuming there are dependencies, why wouldn't the order in source
code also imply order in execution order?
Mathematically, the two different sequences evaluate to different values:
x = y + 1
y = x + 1
assuming y = 0, x = 1
you get:
x = 0 + 1 = 1
y = 1 + 1 = 2
final values for x = 1, y = 2
Now if the order was reversed:
y = x + 1
x = y + 1
assuming the same initial values y = 0, x = 1
y = 1 + 1 = 2
x = 2 + 1 = 3
Notice that the final value for x is different, depending on the order
of the execution.
So, since the order matters (because there are dependencies between the
2 statements, as if there were no dependencies the order would be
irrelevant), then it makes sense that the execution order also follow
the source code order, as the programmer likely wrote the code thinking
that this order would be preserved.
So, I ask again, why would the execution order not follow the source
code order, assuming there was some dependency among them?
Ioan
--
=================================================================
Ioan Raicu, Ph.D.
NSF/CRA Computing Innovation Fellow
=================================================================
Center for Ultra-scale Computing and Information Security (CUCIS)
Department of Electrical Engineering and Computer Science
Northwestern University
2145 Sheridan Rd, Tech M384
Evanston, IL 60208-3118
=================================================================
Cel: 1-847-722-0876
Tel: 1-847-491-8163
Email: iraicu at eecs.northwestern.edu
Web: http://www.eecs.northwestern.edu/~iraicu/
https://wiki.cucis.eecs.northwestern.edu/
=================================================================
=================================================================
Ben Clifford wrote:
>
>> 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.
>
>
--
=================================================================
Ioan Raicu, Ph.D.
NSF/CRA Computing Innovation Fellow
=================================================================
Center for Ultra-scale Computing and Information Security (CUCIS)
Department of Electrical Engineering and Computer Science
Northwestern University
2145 Sheridan Rd, Tech M384
Evanston, IL 60208-3118
=================================================================
Cel: 1-847-722-0876
Tel: 1-847-491-8163
Email: iraicu at eecs.northwestern.edu
Web: http://www.eecs.northwestern.edu/~iraicu/
https://wiki.cucis.eecs.northwestern.edu/
=================================================================
=================================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20100219/ad7950e2/attachment.html>
More information about the Swift-user
mailing list