Should readdlm have a default typed value?

Hello everyone!

I’m currently developing a project which requires reading old text files, Fortran formated arrays. Which means I have huge text files like this:

    0.0071435   0.00745535   0.00776577   0.00807047   0.00803566   0.00798893
   0.00807762   0.00816631   0.00815916   0.00814819   0.00828075   0.00845718
   0.00815868   0.00800419   0.00791979   0.00787973   0.00795364   0.00802708

Using readdlm makes it a breeze! However, my last line is incomplete, having only 3 columns.
Hence the output of readdlm is 554×6 Array{Any,2} and if I set the type to Float64 it errors out since "" cannot be converted to Float64.

Wouldn’t it make sense for an optional default value to be specified? Like:

readdlm(source, delim::AbstractChar, T::Type, eol::AbstractChar; default::T, <omitted for brevity>)

While delimited formats are not strictly specified, columns ending prematurely is probably outside of what most users would consider a valid file. I think it is a good strategy to error for invalid data.

I would recommend that you just code a custom solution for this use case, eg read the file line by line, split the lines, and parse the floats, ending up with a vector of vectors.

In my opinion, this is either a bug or incorrectly documented. The docstring of readdlm tells:

If instead of an empty cell the file contains the string NaN (case insensitive), this is true, but if there is any other non-numeric element it does not take it as NaN, but throws an error.