Julia: string(x::Symbol) should be String(x::Symbol)

Created on 17 Jun 2016  路  5Comments  路  Source: JuliaLang/julia

Just a minor cleanup along with the Stringapalooza party. A good "up-for-grabs" if anyone in particular wants to tackle it.

Hacktoberfest good first issue strings

Most helpful comment

this is #16997.

18152, probably

All 5 comments

Dumb question: Where is string(::Symbol) ?

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0-rc2+1 (2016-08-18 05:47 UTC)
 _/ |\__'_|_|_|\__'_|  |  djcb/bugfix-18073/7cade48 (fork: 1 commits, 6 days)
|__/                   |  x86_64-apple-darwin14.5.0

julia> methods(string)
# 13 methods for generic function "string":
string(dt::Date) at dates/io.jl:18
string(dt::DateTime) at dates/io.jl:5
string(x::Base.Dates.CompoundPeriod) at dates/periods.jl:298
string(id::Base.LibGit2.Oid) at libgit2/oid.jl:69
string(x::BigFloat) at mpfr.jl:853
string(x::BigInt) at gmp.jl:513
string() at strings/basic.jl:10
string(x::Union{Int128,Int16,Int32,Int64,Int8}) at intfuncs.jl:264
string(a::String...) at strings/string.jl:167
string(a::Union{Char,String}...) at strings/string.jl:179
string(s::AbstractString) at strings/basic.jl:11
string{P<:Base.Dates.Period}(x::P) at dates/periods.jl:44
string(xs...) at strings/io.jl:68
julia> @which string(:x)
string(xs...) at strings/io.jl:68

There's no method just for this case, so I guess this is just about adding a method to String.

So, then

String(x::Symbol) = string(x)

is all that this issue is about?

I think closed by #16997

this is #16997.

18152, probably

Was this page helpful?
0 / 5 - 0 ratings