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.




Reply via email to