[Swift-devel] Changes to array closing semantics?

Justin M Wozniak wozniak at mcs.anl.gov
Thu Nov 22 12:02:19 CST 2012


On 11/22/2012 09:44 AM, Tim Armstrong wrote:
>
> Currently we do the dumb thing of incrementing once per loop 
> iteration, but I'm going to make a change soon where, if we know how 
> many loop iterations there are at the time the loop is started, we'll 
> just increment the count by that amount at the start and decrement as 
> each iteration finishes (or actually, since we chunk loops up and 
> distribute them, as each chunk of the loop finishes).  This works well 
> enough.

Just for clarity:  In general, we support conditional insertion: if (c > 
0) { A[i] = c; }.  The conditional code block executes some time in the 
future when the condition is set (possibly somewhere else). We handle 
this by allocating array "slots" before entering subordinate code and 
dropping slots in all cases in the subordinate code.  When the array 
runs out of slots, it closes itself.

We plan to update this in Swift/T 0.2.0 with a framework that will allow 
for reader and writer reference counts- this will enable garbage 
collection when there are no possible read operations.

-- 
Justin M Wozniak




More information about the Swift-devel mailing list