[Swift-devel] problems with external dependencies

Ben Clifford benc at hawaga.org.uk
Tue Mar 24 09:13:25 CDT 2009


On Tue, 24 Mar 2009, Michael Wilde wrote:

> So no matter how many parallel procedure calls a procedure triggers, directly
> or indirectly, through multiple levels of calls, the procedure does not return
> until all the calls below it on the stack have returned.  is that correct?

yes.

> Is it technically the same for the foreach(), and in fact for every other
> statement (eg, if() ) - that each statement essentially starts a "block" that
> may invoke parallel procs, and again, each statement waits for its child
> statements and procs to complete before it completes?

at an implementation level, yes. though 'completes' doesn't have much 
effect in almost all circumstances - compound procedures are the only 
place (I think) where completion of all the statements then causes some 
other effect (the explicit closing of all returned values). everywhere 
else, I think you cannot notice that.

> Is it further true that the term "closing" applies to all vars, of all types,
> whether atomic or compound? 

yes. 

> Where "closed" is the same as "set" for atomic
> vars?

yes


>  And that:
> - the "setting" of external type vars is tied to the procedure that *returns*
> them?

yes

> - the "setting" of other atomic vars happens when they are assigned a value in
> an assignment statement.

yes

> - the setting of arrays is based on flow analysis (as per below, from a prior
> thread)

arrays get closed in two places: when they are returned from a procedure 
call, and when static analysis has determined that all expressions that 
can assign to an array have been evaluated. As you discovered, this second 
only happens for the root of a multidimensional array, so is not 
sufficient...

> - the setting of structures is ??? (when all fields are set or when that
> structure goes out of scope?

Arrays need closing to indicate that all of their members are known. A 
structure has predefined members so closing doesn't come into play there.

> - the setting of file vars means that the file has been created by an app. The
> var contains only a mapping (which is set before the file is created) and a
> state, set/unset, somewhat like externals. So externals are almost? exactly
> like file vars, but have no mapping?

yes. The best analogy is that they are mapped but in your head rather than 
in SwiftScript.

-- 




More information about the Swift-devel mailing list