Question

when trying to initialize an array of UTF8Strings to "", I came across the following problem:

julia> zeros(UTF8String,1)
1-element Array{ASCIIString,1}:
 ""

Somehow the zero string is converted to ASCIIString.

julia> typeof(zeros(UTF8String,1))
Array{ASCIIString,1}

Should it not be the case that an invariant of the following should hold:

typeof(zeros(T,n))==Array{T,1}

I ended up using an uninitialized array.

Is this an issue to report or is it a logical result?

Was it helpful?

Solution

An empty UTF8String array may be created with:

julia> utfstr = UTF8String[]

(the zeros(UTF8String,1) syntax has been removed on the current trunk)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top