[Swift-devel] readData2

Mihael Hategan hategan at mcs.anl.gov
Wed Jul 6 13:19:40 CDT 2011


On Wed, 2011-07-06 at 17:41 +0000, Ben Clifford wrote:
> > Would it make sense to replace readData and readStructured with one flexible
> > function which could use multiple formats? For example:
> > 
> > foo = read( -type="JSON", -file="myfile.json" );
> 
> Not that I particularly advocate doing things this way, but here's a 
> different approach.
> 
> Swift already has a mechanism for specifying the type of a file. Its the 
> swift type system.
> 
>   CSVFile f <"myfile">;
>   foo = read(f);
> 
> That doesn't work so well if you want to specify lots of parameters to 
> influence the reading, on the read line. But it does hark back to the 
> beginning of swift where there was the idea of mapping data into XML.
> 
> Potentially you could define the parameterisation in the type, rather than 
> in the read() call.

Noope! The structure of a given type is fixed. We want the ability to
read arbitrary such structures/types from a given format. Also for a
given type, there can be many formats. So the format is orthogonal to
the type.





More information about the Swift-devel mailing list