Julia: RepString("",1) throws in show

Created on 12 Dec 2016  路  7Comments  路  Source: JuliaLang/julia

julia> RepString("",1)
"Error showing value of type RepString:
ERROR: BoundsError: attempt to access 0-element Array{UInt8,1} at index [0]
 in next(::String, ::Int64) at ./strings/string.jl:88
 in next(::String, ::Int64) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
 in escape_string(::IOContext{Base.Terminals.TTYTerminal}, ::RepString, ::String) at ./strings/io.jl:139
 in print_quoted at ./strings/io.jl:158 [inlined]
 in show at ./strings/io.jl:72 [inlined]
 in show at ./replutil.jl:4 [inlined]
 in display(::Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, ::MIME{Symbol("text/plain")}, ::RepString) at ./REPL.jl:132
...

I noticed this when testing out #19548. (Bug appears to be in all Julia versions since at least 0.3.)

bug strings

Most helpful comment

RepString should just be deleted and moved into LegacyStrings.

All 7 comments

(I don't know why we have this type at all. I can't find a single package that uses it explicitly, nor do we use it in Base except for s^n when s is a non-String string. When is efficient handling of repeated strings important?)

@StefanKarpinski had mentioned merging SubString with String. Perhaps RepString (and maybe even RevString) could be merged with String as well?

RepString should just be deleted and moved into LegacyStrings.

SubString we still need until we improve the performance of String.

Should RevString go as well?

Yes, very likely.

Was this page helpful?
0 / 5 - 0 ratings