[julia-users] Re: what do you do with strings in julia
On Tuesday, January 13, 2015 at 2:50:34 PM UTC-5, Evan Pu wrote: what is the convention? I kept getting `convert` has no method matching convert(::Type{SubString(UTF8String)}}, ::ASCIIString) all the time, every time What are you doing that triggers this error? I'm guessing that you have an array A of substrings (a special string type that represents a portion of another string; e.g. this is used for regular expression matches) and you are trying to assign an ordinary string to A[i]. This fails because there is (currently) no conversion method defined from other string types to substrings. If you want to make your array A able to hold arbitrary strings, not just substrings, you should give it a type that can hold arbitrary strings. e.g. if you are using a comprehension to define A, you could give it a type A = String[] to say that A can hold arbitrary string objects.
[julia-users] Re: what do you do with strings in julia
Though we could define such a conversion method with: convert{T:AbstractString}(::Type{SubString{T}}, s::AbstractString) = let s′ = T(s); SubString(s′, 1, endof(s′)); end Evan, what is your application here? What are you trying to do?
[julia-users] Re: what do you do with strings in julia
Steven, The error is actually an issue with LightTable's Juno plugin and actually has nothing to do with Julia. I think what happened is in reporting the errors the plugin makes some mistake and ended up reporting another error(or itself had some misuse of strings) instead. The actual error was discovered while running it from the command shell is in fact: ERROR: assertion failed in ∫ at SimplePoly.jl:286 in ∫ at SimplePoly.jl:518 in ∫ at SimplePoly.jl:786 in ∫ at Factor.jl:153 which seems more reasonable, as the assertion is the one I wrote. sorry for the troubles! On Tuesday, January 13, 2015 at 3:16:44 PM UTC-5, Steven G. Johnson wrote: Though we could define such a conversion method with: convert{T:AbstractString}(::Type{SubString{T}}, s::AbstractString) = let s′ = T(s); SubString(s′, 1, endof(s′)); end Evan, what is your application here? What are you trying to do?
[julia-users] Re: what do you do with strings in julia
On Tuesday, January 13, 2015 at 4:10:54 PM UTC-5, Evan Pu wrote: Steven, The error is actually an issue with LightTable's Juno plugin and actually has nothing to do with Julia. Can you file an issue at: https://github.com/one-more-minute/Jewel.jl explaining how the error arose?
[julia-users] Re: what do you do with strings in julia
I'll try. the call chain is rather large and I'll see if I can get it down to a few constructs. On Tuesday, January 13, 2015 at 4:34:39 PM UTC-5, Steven G. Johnson wrote: On Tuesday, January 13, 2015 at 4:10:54 PM UTC-5, Evan Pu wrote: Steven, The error is actually an issue with LightTable's Juno plugin and actually has nothing to do with Julia. Can you file an issue at: https://github.com/one-more-minute/Jewel.jl explaining how the error arose?