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

Mihael Hategan hategan at mcs.anl.gov
Fri Sep 7 14:36:07 CDT 2007


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?




More information about the Swift-devel mailing list