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

Michael Wilde wilde at mcs.anl.gov
Fri Sep 7 15:33:53 CDT 2007


Is the retval file being considered, or do people prefer to pull 
variables out of files through Swift mapping directives?

It seems to me that a general way to return multiple scalar/list values 
of built-in data types is useful and will keep the Swift code clearer.

- Mike


Mihael Hategan wrote:
> On Fri, 2007-09-07 at 19:08 +0000, Ben Clifford wrote:
>> On Fri, 7 Sep 2007, Yong Zhao wrote:
>>
>>> Just want to make a short comment that Ian once mentioned the syntax
>>>
>>> int i<"myint.txt">;
>>>
>>> should be valid, so you don't need the weird @extractint function.
> 
> You do. The question is where it appears. Should we allow writing
> mappers nicely in Swift?
> 
> intMapper(string fileName) {
>   string fileName(): fileName;
>   int get(): atoi(read(fileName));
>   set(int value): write(fileName, itoa(value));
> }
> 
> or stick to Java:
> 
> IntMapper extends SingleFileMapper {
>  DSHandle getValue() {
>    return RootNode.newInstance(Types.INT, new
> Integer(readFile(fileName)));
>  }
> 
>  void setValue(DSHandle val) {
>    writeToFile(fileName, String.valueOf(val));
>  }
> }
> 
> or do it on the fly:
> int i = @extractint(file)
> 
> Or all of them?
> 
> _______________________________________________
> 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