What if the file name is only known at run time? I'm all for better lint and warning tools to help those who want to remove type stability, but bear in mind that not everyone does. I for one really like the convenience of dynamic typing for non-performance-sensitive code.
On 3 January 2015 at 12:57, Ariel Keselman <[email protected]> wrote: > > well, I've just opened a pull request where qrfact is type-stable (using > staged functions of course) see here: > > https://github.com/JuliaLang/julia/pull/9575 > > The same could be done for the other functions you mentioned (e.g. > factorize, sqrtm, etc.) and I'll do if the current one is positively > accepted. > > staged functions can help with many of these cases, and macros can help in > others. For e.g. loading a vector from an HDF file (or a table from a CSV > file)) could be done in a type-stable way by pushing the instability into > the macro expansion stage (so we have type stability once again in the > sense that when compiling the compiler would see a type stable expanded > unction) > > imagine something along the following lines, I think this could be > achieved with current Julia: > > function load_vector_from_hdf5_file(filename, vecname, coltype) > # read the vector using the given column type, this is type-stable > end > > macro load_vector_from_hdf5_file(filename, vecname) > quote > coltype = get_vector_coltype_from_file($filename) > load_vector_from_hdf5_file($filename, $vecname, coltype) > end > end > > this could be used to load hdf5/csv files w/o specifying types in a > type-stable manner. > > > > >
