[Swift-devel] Re: [Swift-user] assigning file variables

Michael Wilde wilde at mcs.anl.gov
Fri Feb 27 08:55:53 CST 2009


Thats a good explanation, worth adding to the user guide text on this topic.

I think on first read one (eg, me ;) misses the subtlety that the 
foreach is special in how the array is treated within it, and that 
outside foreach statements, arrays need to be closed.

The challenge will be to see in general how feasible it is to code in 
such a way that you always to a close via a procedure return. My guess 
is it will be feasible, but may lead to more procedures than a user 
might use in an imperative style.

Thats not bad, as long as coding is easy and the resulting code is clear.

We're getting some good experience now as we build libraries for CNARI, 
OOPS, DOCK and more.

related: whats a suggested debugging technique when "the next stage isnt 
running"? Thats exactly what happened to me, and one of the harder 
things in swift to debug.

I noticed by chance the other day that swift seems to read debugging 
commands of some sort from stdin? I may have missed it, but what are 
these, and can users use them to find the state of a stuck script?

On 2/27/09 4:02 AM, Ben Clifford wrote:
> On Thu, 26 Feb 2009, Ben Clifford wrote:
> 
>> This style of piecewise assignment to arrays plays merry hell with 
>> trying to do data-dependent ordering in a way that I think is not easily 
>> resolvable; and anyone trying to do anything at all interesting with 
>> arrays gets hit by strange things happening - "I know i've assigned 
>> everything but somehow the next stage isn't running".
> 
> A different way of looking at this:
> 
> Why is it that Swift can have the 'close array returned from a procedure 
> call' behaviour which made you move code out of the loop body and into a 
> procedure?
> 
> Its because from the calling code, the procedure call looks like a single 
> assignment:
> 
>   file a[] = foo();
> 
> or when accessing sub-arrays:
> 
>   file a[][];
>   a[7] = foo();
> 
> We know a[7], which is an entire array, has its entire value because that 
> assignment is the only place that a[7] can have its elements assigned - 
> there is a single statement which assigns its entire value.
> 



More information about the Swift-devel mailing list