[Swift-devel] folding/sequential-while/whatever and accessing data in files

Michael Wilde wilde at mcs.anl.gov
Fri Sep 7 07:03:41 CDT 2007


This problem is caused by the fact that swift functions can accept 
integer values as arguments but cannot generate them as returns.

In the early Swift language discussions I advocated a means by which a 
function could return an arbitrary number of integer values:

- in the app wrapper, one could designate a "value return file" that 
would be created by the application
- the value return file would contain a simple list of names and value
- the values could be any swift expression composed of swift literals 
(scalars or lists)

(int error, string perror, SomeFile next ) new_approximation (previous)
{
   app RETVAL { ... }
}

The RETVAL keyword (caps mine) would signify that the app will produce a 
RETVAL file and that the runtime system should use this file to set 
return values as it indicates.

- Mike


Ben Clifford wrote:
> One of the problems at the moment with implementing a 
> fold/sequential-for/while loop is that I think a lot of the use cases want 
> to make the termination condition be based on the output of the programs 
> involved in the computation.
> 
> At the moment, there isn't a way to get data from 'file space' into 'swift 
> expression space' so  something like this[1]:
> 
> iterate until error < 0.1 {
>   next = make_a_new_approximation(previous);
>   error = compute_error(next);
> }
> 
> fails in the present system because 'error' is a file-like entity (being 
> the output of the compute_error application) rather than a 
> swift-value-like entity (which is held in memory and can be used in 
> expressions)
> 
> I think mappers need to be made to address this.
> 
> [1] syntax that i made up specifically for this email and that I do not 
> advocate for use.
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> http://mail.ci.uchicago.edu/mailman/listinfo/swift-devel
> 
> 



More information about the Swift-devel mailing list