diff --git a/base/REPL.jl b/base/REPL.jl index bf407d1da98522..6ce6fece64d32f 100644 --- a/base/REPL.jl +++ b/base/REPL.jl @@ -345,7 +345,7 @@ function hist_from_file(hp, file) m = match(r"^#\s*(\w+)\s*:\s*(.*?)\s*$", line) m === nothing && break if m.captures[1] == "mode" - mode = symbol(m.captures[2]) + mode = Symbol(m.captures[2]) end line = hist_getline(file) countlines += 1 @@ -731,7 +731,7 @@ function setup_interface(repl::LineEditREPL; hascolor = repl.hascolor, extra_rep # and pass into Base.repl_cmd for processing (handles `ls` and `cd` # special) on_done = respond(repl, julia_prompt) do line - Expr(:call, :(Base.repl_cmd), macroexpand(Expr(:macrocall, symbol("@cmd"),line)), outstream(repl)) + Expr(:call, :(Base.repl_cmd), macroexpand(Expr(:macrocall, Symbol("@cmd"),line)), outstream(repl)) end) diff --git a/base/abstractarray.jl b/base/abstractarray.jl index a47260ec498dfd..0e8aca6ed62d15 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -968,11 +968,11 @@ end exprs = Expr[:(ind = ind-1)] for i = 1:N-1 push!(exprs,:(ind2 = div(ind,dims[$i]))) - push!(exprs,Expr(:(=),symbol(:s,i),:(ind-dims[$i]*ind2+1))) + push!(exprs,Expr(:(=),Symbol(:s,i),:(ind-dims[$i]*ind2+1))) push!(exprs,:(ind=ind2)) end - push!(exprs,Expr(:(=),symbol(:s,N),:(ind+1))) - Expr(:block,meta,exprs...,Expr(:tuple,[symbol(:s,i) for i=1:N]...)) + push!(exprs,Expr(:(=),Symbol(:s,N),:(ind+1))) + Expr(:block,meta,exprs...,Expr(:tuple,[Symbol(:s,i) for i=1:N]...)) end ind2sub(a::AbstractArray, ind::Integer) = ind2sub(size(a), ind) diff --git a/base/atomics.jl b/base/atomics.jl index acf7ef2ee0f861..5fa3c6a30c42ad 100644 --- a/base/atomics.jl +++ b/base/atomics.jl @@ -292,7 +292,7 @@ for typ in atomictypes end for rmwop in [:xchg, :add, :sub, :and, :nand, :or, :xor, :max, :min] rmw = string(rmwop) - fn = symbol("atomic_", rmw, "!") + fn = Symbol("atomic_", rmw, "!") if (rmw == "max" || rmw == "min") && typ <: Unsigned # LLVM distinguishes signedness in the operation, not the integer type. rmw = "u" * rmw @@ -321,7 +321,7 @@ end const opnames = Dict{Symbol, Symbol}(:+ => :add, :- => :sub) for op in [:+, :-, :max, :min] opname = get(opnames, op, op) - @eval function $(symbol("atomic_", opname, "!")){T<:FloatTypes}(var::Atomic{T}, val::T) + @eval function $(Symbol("atomic_", opname, "!")){T<:FloatTypes}(var::Atomic{T}, val::T) IT = inttype(T) old = var[] while true diff --git a/base/broadcast.jl b/base/broadcast.jl index d68323a3024979..99c80aa3654935 100644 --- a/base/broadcast.jl +++ b/base/broadcast.jl @@ -167,7 +167,7 @@ function gen_broadcast_body_iter_tobitarray(nd::Int, narrays::Int, f) end function gen_broadcast_function(genbody::Function, nd::Int, narrays::Int, f) - As = [symbol("A_"*string(i)) for i = 1:narrays] + As = [Symbol("A_"*string(i)) for i = 1:narrays] body = genbody(nd, narrays, f) @eval let local _F_ @@ -179,7 +179,7 @@ function gen_broadcast_function(genbody::Function, nd::Int, narrays::Int, f) end function gen_broadcast_function_tobitarray(genbody::Function, nd::Int, narrays::Int, f) - As = [symbol("A_"*string(i)) for i = 1:narrays] + As = [Symbol("A_"*string(i)) for i = 1:narrays] body = genbody(nd, narrays, f) @eval let local _F_ diff --git a/base/cartesian.jl b/base/cartesian.jl index 1fe642a26806b6..a387ef1bb61e77 100644 --- a/base/cartesian.jl +++ b/base/cartesian.jl @@ -258,7 +258,7 @@ function inlineanonymous(ex::Expr, val) end # Given :i and 3, this generates :i_3 -inlineanonymous(base::Symbol, ext) = symbol(base,"_",string(ext)) +inlineanonymous(base::Symbol, ext) = Symbol(base,"_",string(ext)) # Replace a symbol by a value or a "coded" symbol # E.g., for d = 3, @@ -277,7 +277,7 @@ lreplace(ex, sym::Symbol, val) = lreplace!(copy(ex), LReplace(sym, val)) function lreplace!(sym::Symbol, r::LReplace) sym == r.pat_sym && return r.val - symbol(lreplace!(string(sym), r)) + Symbol(lreplace!(string(sym), r)) end function lreplace!(str::AbstractString, r::LReplace) @@ -323,7 +323,7 @@ function lreplace!(ex::Expr, r::LReplace) if ex.head == :curly && length(ex.args) == 2 && isa(ex.args[1], Symbol) && endswith(string(ex.args[1]), "_") excurly = Base.Cartesian.exprresolve(lreplace!(ex.args[2], r)) if isa(excurly, Number) - return symbol(ex.args[1],excurly) + return Symbol(ex.args[1],excurly) else ex.args[2] = excurly return ex diff --git a/base/client.jl b/base/client.jl index b4ee21ad259dd4..1b5f65d4fc7934 100644 --- a/base/client.jl +++ b/base/client.jl @@ -44,7 +44,7 @@ default_color_info = :blue color_normal = text_colors[:normal] function repl_color(key, default) - c = symbol(get(ENV, key, "")) + c = Symbol(get(ENV, key, "")) haskey(text_colors, c) ? c : default end @@ -284,7 +284,7 @@ function load_machine_file(path::AbstractString) for line in split(readstring(path),'\n'; keep=false) s = map!(strip, split(line,'*'; keep=false)) if length(s) > 1 - cnt = isnumber(s[1]) ? parse(Int,s[1]) : symbol(s[1]) + cnt = isnumber(s[1]) ? parse(Int,s[1]) : Symbol(s[1]) push!(machines,(s[2], cnt)) else push!(machines,line) diff --git a/base/dates/accessors.jl b/base/dates/accessors.jl index e14cdd4e632341..4592f30370d7e9 100644 --- a/base/dates/accessors.jl +++ b/base/dates/accessors.jl @@ -127,7 +127,7 @@ end for parts in (["year", "month"], ["month", "day"], ["year", "month", "day"]) name = join(parts) - func = symbol(name) + func = Symbol(name) @eval begin @doc """ $($name)(dt::TimeType) -> ($(join(repeated(Int64, length($parts)), ", "))) diff --git a/base/dates/arithmetic.jl b/base/dates/arithmetic.jl index 947b0eef4f3eae..4a94fc13df9116 100644 --- a/base/dates/arithmetic.jl +++ b/base/dates/arithmetic.jl @@ -67,7 +67,7 @@ end (-)(y::Period,x::TimeType) = x - y for op in (:.+, :.-) - op_ = symbol(string(op)[2:end]) + op_ = Symbol(string(op)[2:end]) @eval begin # GeneralPeriod, AbstractArray{TimeType} ($op){T<:TimeType}(x::AbstractArray{T}, y::GeneralPeriod) = diff --git a/base/dates/periods.jl b/base/dates/periods.jl index 1189f497f3bfd1..766aa1d50f04b9 100644 --- a/base/dates/periods.jl +++ b/base/dates/periods.jl @@ -25,7 +25,7 @@ for period in (:Year, :Month, :Week, :Day, :Hour, :Minute, :Second, :Millisecond The $($accessor_str) part of a $($description) as a `$($period_str)`.$($reference) """ -> - $period(dt::$(symbol(typ_str))) = $period($(symbol(accessor_str))(dt)) + $period(dt::$(Symbol(typ_str))) = $period($(Symbol(accessor_str))(dt)) @doc """ $($period_str)(v) @@ -95,7 +95,7 @@ for (op,Ty,Tz) in ((:.*,Real,:P), (:.%,:P,:P), (:mod,:P,:P)) sop = string(op) - op_ = sop[1] == '.' ? symbol(sop[2:end]) : op + op_ = sop[1] == '.' ? Symbol(sop[2:end]) : op @eval begin function ($op){P<:Period}(X::StridedArray{P},y::$Ty) Z = similar(X, $Tz) @@ -234,7 +234,7 @@ GeneralPeriod = Union{Period,CompoundPeriod} (+){P<:GeneralPeriod}(x::StridedArray{P}) = x for op in (:.+, :.-) - op_ = symbol(string(op)[2:end]) + op_ = Symbol(string(op)[2:end]) @eval begin function ($op){P<:GeneralPeriod}(X::StridedArray{P},y::GeneralPeriod) Z = similar(X, CompoundPeriod) diff --git a/base/deprecated.jl b/base/deprecated.jl index 5cc14c9fb55329..a5760d9387fe35 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -560,7 +560,7 @@ end @deprecate_binding MathConst Irrational macro math_const(sym, val, def) - depwarn("@math_const is deprecated and renamed to @irrational.", symbol("@math_const")) + depwarn("@math_const is deprecated and renamed to @irrational.", Symbol("@math_const")) :(@irrational $(esc(sym)) $(esc(val)) $(esc(def))) end export @math_const @@ -689,7 +689,7 @@ include("require.jl") # require("Foo") --- ambiguous. might be file or package filename = maybe_require_file(f) if filename == f - mod = symbol(require_modname(f)) + mod = Symbol(require_modname(f)) M = current_module() if isdefined(M,mod) && isa(eval(M,mod),Module) return @@ -930,7 +930,7 @@ end #14474 macro boundscheck(yesno,blk) - depwarn("The meaning of `@boundscheck` has changed. It now indicates that the provided code block performs bounds checking, and may be elided when inbounds.", symbol("@boundscheck")) + depwarn("The meaning of `@boundscheck` has changed. It now indicates that the provided code block performs bounds checking, and may be elided when inbounds.", Symbol("@boundscheck")) if yesno === true :(@inbounds $(esc(blk))) end @@ -1082,6 +1082,9 @@ end @deprecate sprand{T}(n::Integer, density::AbstractFloat, ::Type{T}) sprand(T, n, density) @deprecate sprand{T}(r::AbstractRNG, n::Integer, density::AbstractFloat, ::Type{T}) sprand(r, T, n, density) +#16130 +@deprecate symbol Symbol + # During the 0.5 development cycle, do not add any deprecations below this line # To be deprecated in 0.6 diff --git a/base/dft.jl b/base/dft.jl index 1d26d69a6ca2e8..b23f10a5b080bc 100644 --- a/base/dft.jl +++ b/base/dft.jl @@ -31,7 +31,7 @@ complexfloat{T<:Real}(x::AbstractArray{T}) = copy!(Array(typeof(complex(float(on # implementations only need to provide plan_X(x, region) # for X in (:fft, :bfft, ...): for f in (:fft, :bfft, :ifft, :fft!, :bfft!, :ifft!, :rfft) - pf = symbol(string("plan_", f)) + pf = Symbol(string("plan_", f)) @eval begin $f(x::AbstractArray) = $pf(x) * x $f(x::AbstractArray, region) = $pf(x, region) * x @@ -179,7 +179,7 @@ bfft! # promote to a complex floating-point type (out-of-place only), # so implementations only need Complex{Float} methods for f in (:fft, :bfft, :ifft) - pf = symbol(string("plan_", f)) + pf = Symbol(string("plan_", f)) @eval begin $f{T<:Real}(x::AbstractArray{T}, region=1:ndims(x)) = $f(complexfloat(x), region) $pf{T<:Real}(x::AbstractArray{T}, region; kws...) = $pf(complexfloat(x), region; kws...) @@ -264,7 +264,7 @@ A_mul_B!(y::AbstractArray, p::ScaledPlan, x::AbstractArray) = # or odd). for f in (:brfft, :irfft) - pf = symbol(string("plan_", f)) + pf = Symbol(string("plan_", f)) @eval begin $f(x::AbstractArray, d::Integer) = $pf(x, d) * x $f(x::AbstractArray, d::Integer, region) = $pf(x, d, region) * x diff --git a/base/docs/Docs.jl b/base/docs/Docs.jl index dd379362f78111..140d8734207426 100644 --- a/base/docs/Docs.jl +++ b/base/docs/Docs.jl @@ -391,7 +391,7 @@ const keywords = Dict{Symbol, DocStr}() isdoc(s::AbstractString) = true isdoc(x) = isexpr(x, :string) || - (isexpr(x, :macrocall) && x.args[1] == symbol("@doc_str")) || + (isexpr(x, :macrocall) && x.args[1] == Symbol("@doc_str")) || (isexpr(x, :call) && x.args[1] == Base.Markdown.doc_str) function unblock(ex) @@ -417,7 +417,7 @@ nameof(q::QuoteNode, ismacro) = nameof(q.value, ismacro) nameof(s::Symbol, ismacro) = ismacro ? macroname(s) : s nameof(other, ismacro) = other -macroname(s::Symbol) = symbol('@', s) +macroname(s::Symbol) = Symbol('@', s) macroname(x::Expr) = Expr(x.head, x.args[1], macroname(x.args[end].value)) isfield(x) = isexpr(x, :.) && @@ -538,7 +538,7 @@ function __doc__!(meta, def, define) # the Base image). We just need to convert each `@__doc__` marker to an `@doc`. finddoc(def) do each each.head = :macrocall - each.args = [symbol("@doc"), meta, each.args[end], define] + each.args = [Symbol("@doc"), meta, each.args[end], define] end else # `def` has already been defined during Base image gen so we just need to find and diff --git a/base/docs/basedocs.jl b/base/docs/basedocs.jl index bdff101deec582..a7155e71dbf2f8 100644 --- a/base/docs/basedocs.jl +++ b/base/docs/basedocs.jl @@ -5,7 +5,7 @@ module BaseDocs immutable Keyword name :: Symbol end -macro kw_str(text) Keyword(symbol(text)) end +macro kw_str(text) Keyword(Symbol(text)) end "Hello, Human." kw"hello", kw"hi" diff --git a/base/docs/helpdb/Base.jl b/base/docs/helpdb/Base.jl index 2ff77c7ddae5f3..acdcf14ef29067 100644 --- a/base/docs/helpdb/Base.jl +++ b/base/docs/helpdb/Base.jl @@ -6786,7 +6786,7 @@ to define a new `writemime` method for `T`, via: `writemime(stream, ::MIME"mime" where `mime` is a MIME-type string and the function body calls `write` (or similar) to write that representation of `x` to `stream`. (Note that the `MIME""` notation only supports literal strings; to construct `MIME` types in a more flexible manner use -`MIME{symbol("")}`.) +`MIME{Symbol("")}`.) For example, if you define a `MyImage` type and know how to write it to a PNG file, you could define a function `writemime(stream, ::MIME"image/png", x::MyImage) = ...` to allow @@ -9555,11 +9555,11 @@ Create an array of all zeros with the same element type and shape as `A`. zeros(A) """ - symbol(x...) -> Symbol + Symbol(x...) -> Symbol Create a `Symbol` by concatenating the string representations of the arguments together. """ -symbol +Symbol """ zeta(s) diff --git a/base/docs/utils.jl b/base/docs/utils.jl index fbd6b54b86455f..d03dcdc1ac0a4b 100644 --- a/base/docs/utils.jl +++ b/base/docs/utils.jl @@ -94,10 +94,10 @@ end function helpmode(line::AbstractString) line = strip(line) expr = - if haskey(keywords, symbol(line)) + if haskey(keywords, Symbol(line)) # Docs for keywords must be treated separately since trying to parse a single # keyword such as `function` would throw a parse error due to the missing `end`. - symbol(line) + Symbol(line) else x = Base.syntax_deprecation_warnings(false) do parse(line, raise = false) @@ -141,7 +141,7 @@ function repl(s::Symbol) end end -isregex(x) = isexpr(x, :macrocall, 2) && x.args[1] == symbol("@r_str") && !isempty(x.args[2]) +isregex(x) = isexpr(x, :macrocall, 2) && x.args[1] == Symbol("@r_str") && !isempty(x.args[2]) repl(ex::Expr) = isregex(ex) ? :(apropos($ex)) : _repl(ex) diff --git a/base/expr.jl b/base/expr.jl index 132047b4e074ba..18a4d946e467f0 100644 --- a/base/expr.jl +++ b/base/expr.jl @@ -2,12 +2,12 @@ ## symbols ## -symbol(s::Symbol) = s -symbol(s::ASCIIString) = symbol(s.data) -symbol(s::UTF8String) = symbol(s.data) -symbol(a::Array{UInt8,1}) = +Symbol(s::Symbol) = s +Symbol(s::ASCIIString) = Symbol(s.data) +Symbol(s::UTF8String) = Symbol(s.data) +Symbol(a::Array{UInt8,1}) = ccall(:jl_symbol_n, Ref{Symbol}, (Ptr{UInt8}, Int32), a, length(a)) -symbol(x...) = symbol(string(x...)) +Symbol(x...) = Symbol(string(x...)) gensym() = ccall(:jl_gensym, Ref{Symbol}, ()) diff --git a/base/fft/FFTW.jl b/base/fft/FFTW.jl index cbeb928c4273b9..b4a8cec56ee016 100644 --- a/base/fft/FFTW.jl +++ b/base/fft/FFTW.jl @@ -575,8 +575,8 @@ fftwfloat{T<:Real}(X::AbstractArray{T}) = copy!(Array(Float64, size(X)), X) fftwfloat{T<:Complex}(X::AbstractArray{T}) = fftwcomplex(X) for (f,direction) in ((:fft,FORWARD), (:bfft,BACKWARD)) - plan_f = symbol("plan_",f) - plan_f! = symbol("plan_",f,"!") + plan_f = Symbol("plan_",f) + plan_f! = Symbol("plan_",f,"!") idirection = -direction @eval begin function $plan_f{T<:fftwComplex,N}(X::StridedArray{T,N}, region; @@ -734,7 +734,7 @@ plan_brfft # FFTW r2r transforms (low-level interface) for f in (:r2r, :r2r!) - pf = symbol("plan_", f) + pf = Symbol("plan_", f) @eval begin $f{T<:fftwNumber}(x::AbstractArray{T}, kinds) = $pf(x, kinds) * x $f{T<:fftwNumber}(x::AbstractArray{T}, kinds, region) = $pf(x, kinds, region) * x diff --git a/base/fft/dct.jl b/base/fft/dct.jl index 487089b4f26987..edd41c3722d159 100644 --- a/base/fft/dct.jl +++ b/base/fft/dct.jl @@ -82,7 +82,7 @@ function plan_inv{T,K,inplace}(p::DCTPlan{T,K,inplace}) end for f in (:dct, :dct!, :idct, :idct!) - pf = symbol(string("plan_", f)) + pf = Symbol(string("plan_", f)) @eval begin $f{T<:fftwNumber}(x::AbstractArray{T}) = $pf(x) * x $f{T<:fftwNumber}(x::AbstractArray{T}, region) = $pf(x, region) * x diff --git a/base/inference.jl b/base/inference.jl index 19f4da1e870c87..90be68f0ea9202 100644 --- a/base/inference.jl +++ b/base/inference.jl @@ -2972,7 +2972,7 @@ function inlining_pass(e::Expr, sv, linfo) return (e,stmts) end -const compiler_temp_sym = symbol("#temp#") +const compiler_temp_sym = Symbol("#temp#") function add_slot!(linfo::LambdaInfo, typ, is_sa) id = length(linfo.slotnames)+1 diff --git a/base/latex_symbols.jl b/base/latex_symbols.jl index 4826701081d6fe..94dd84a2d62a31 100644 --- a/base/latex_symbols.jl +++ b/base/latex_symbols.jl @@ -55,7 +55,7 @@ open(fname) do f x = map(s -> rstrip(s, [' ','\t','\n']), split(replace(L, r"[{}\"]+", "\t"), "\t")) c = Char(parse(Int, x[2], 16)) - if (Base.is_id_char(c) || Base.isoperator(symbol(c))) && + if (Base.is_id_char(c) || Base.isoperator(Symbol(c))) && string(c) ∉ latex_strings && !isascii(c) tabcomname = escape_string(x[3]) if startswith(tabcomname, "\\\\math") diff --git a/base/libuv.jl b/base/libuv.jl index b0116cd613d7ef..11d649860d1e01 100644 --- a/base/libuv.jl +++ b/base/libuv.jl @@ -20,10 +20,10 @@ function uv_sizeof_req(req) end for h in uv_handle_types -@eval const $(symbol("_sizeof_"*lowercase(string(h)))) = uv_sizeof_handle($h) +@eval const $(Symbol("_sizeof_"*lowercase(string(h)))) = uv_sizeof_handle($h) end for r in uv_req_types -@eval const $(symbol("_sizeof_"*lowercase(string(r)))) = uv_sizeof_req($r) +@eval const $(Symbol("_sizeof_"*lowercase(string(r)))) = uv_sizeof_req($r) end uv_handle_data(handle) = ccall(:jl_uv_handle_data,Ptr{Void},(Ptr{Void},),handle) diff --git a/base/linalg/arnoldi.jl b/base/linalg/arnoldi.jl index ca0fd1075cbf1b..c9aa47e18dc785 100644 --- a/base/linalg/arnoldi.jl +++ b/base/linalg/arnoldi.jl @@ -180,7 +180,7 @@ function _eigs(A, B; if isa(which,AbstractString) warn("Use symbols instead of strings for specifying which eigenvalues to compute") - which=symbol(which) + which=Symbol(which) end if (which != :LM && which != :SM && which != :LR && which != :SR && which != :LI && which != :SI && which != :BE) diff --git a/base/linalg/cholesky.jl b/base/linalg/cholesky.jl index f6b48eeafb7ecf..390ee3c019331d 100644 --- a/base/linalg/cholesky.jl +++ b/base/linalg/cholesky.jl @@ -207,14 +207,14 @@ size(C::Union{Cholesky, CholeskyPivoted}) = size(C.factors) size(C::Union{Cholesky, CholeskyPivoted}, d::Integer) = size(C.factors, d) function getindex{T,S}(C::Cholesky{T,S}, d::Symbol) - d == :U && return UpperTriangular(symbol(C.uplo) == d ? C.factors : C.factors') - d == :L && return LowerTriangular(symbol(C.uplo) == d ? C.factors : C.factors') - d == :UL && return symbol(C.uplo) == :U ? UpperTriangular(C.factors) : LowerTriangular(C.factors) + d == :U && return UpperTriangular(Symbol(C.uplo) == d ? C.factors : C.factors') + d == :L && return LowerTriangular(Symbol(C.uplo) == d ? C.factors : C.factors') + d == :UL && return Symbol(C.uplo) == :U ? UpperTriangular(C.factors) : LowerTriangular(C.factors) throw(KeyError(d)) end function getindex{T<:BlasFloat}(C::CholeskyPivoted{T}, d::Symbol) - d == :U && return UpperTriangular(symbol(C.uplo) == d ? C.factors : C.factors') - d == :L && return LowerTriangular(symbol(C.uplo) == d ? C.factors : C.factors') + d == :U && return UpperTriangular(Symbol(C.uplo) == d ? C.factors : C.factors') + d == :L && return LowerTriangular(Symbol(C.uplo) == d ? C.factors : C.factors') d == :p && return C.piv if d == :P n = size(C, 1) diff --git a/base/linalg/symmetric.jl b/base/linalg/symmetric.jl index 9ba9673e9da637..d4ebe7344a2ca0 100644 --- a/base/linalg/symmetric.jl +++ b/base/linalg/symmetric.jl @@ -50,10 +50,10 @@ full(A::Hermitian) = copytri!(copy(A.data), A.uplo, true) parent(A::HermOrSym) = A.data convert{T,S<:AbstractMatrix}(::Type{Symmetric{T,S}},A::Symmetric{T,S}) = A convert{T,S<:AbstractMatrix}(::Type{Symmetric{T,S}},A::Symmetric) = Symmetric{T,S}(convert(S,A.data),A.uplo) -convert{T}(::Type{AbstractMatrix{T}}, A::Symmetric) = Symmetric(convert(AbstractMatrix{T}, A.data), symbol(A.uplo)) +convert{T}(::Type{AbstractMatrix{T}}, A::Symmetric) = Symmetric(convert(AbstractMatrix{T}, A.data), Symbol(A.uplo)) convert{T,S<:AbstractMatrix}(::Type{Hermitian{T,S}},A::Hermitian{T,S}) = A convert{T,S<:AbstractMatrix}(::Type{Hermitian{T,S}},A::Hermitian) = Hermitian{T,S}(convert(S,A.data),A.uplo) -convert{T}(::Type{AbstractMatrix{T}}, A::Hermitian) = Hermitian(convert(AbstractMatrix{T}, A.data), symbol(A.uplo)) +convert{T}(::Type{AbstractMatrix{T}}, A::Hermitian) = Hermitian(convert(AbstractMatrix{T}, A.data), Symbol(A.uplo)) copy{T,S}(A::Symmetric{T,S}) = (B = copy(A.data); Symmetric{T,typeof(B)}(B,A.uplo)) copy{T,S}(A::Hermitian{T,S}) = (B = copy(A.data); Hermitian{T,typeof(B)}(B,A.uplo)) ishermitian(A::Hermitian) = true @@ -138,7 +138,7 @@ A_mul_B!{T<:BlasComplex,S<:StridedMatrix}(C::StridedMatrix{T}, A::StridedMatrix{ *(A::HermOrSym, B::HermOrSym) = full(A)*full(B) *(A::StridedMatrix, B::HermOrSym) = A*full(B) -bkfact(A::HermOrSym) = bkfact(A.data, symbol(A.uplo), issymmetric(A)) +bkfact(A::HermOrSym) = bkfact(A.data, Symbol(A.uplo), issymmetric(A)) factorize(A::HermOrSym) = bkfact(A) # Is just RealHermSymComplexHerm, but type alias seems to be broken @@ -146,10 +146,10 @@ det{T<:Real,S}(A::Union{Hermitian{T,S}, Symmetric{T,S}, Hermitian{Complex{T},S}} det{T<:Real}(A::Symmetric{T}) = det(bkfact(A)) det(A::Symmetric) = det(bkfact(A)) -\{T,S<:StridedMatrix}(A::HermOrSym{T,S}, B::StridedVecOrMat) = \(bkfact(A.data, symbol(A.uplo), issymmetric(A)), B) +\{T,S<:StridedMatrix}(A::HermOrSym{T,S}, B::StridedVecOrMat) = \(bkfact(A.data, Symbol(A.uplo), issymmetric(A)), B) -inv{T<:BlasFloat,S<:StridedMatrix}(A::Hermitian{T,S}) = Hermitian{T,S}(inv(bkfact(A.data, symbol(A.uplo))), A.uplo) -inv{T<:BlasFloat,S<:StridedMatrix}(A::Symmetric{T,S}) = Symmetric{T,S}(inv(bkfact(A.data, symbol(A.uplo), true)), A.uplo) +inv{T<:BlasFloat,S<:StridedMatrix}(A::Hermitian{T,S}) = Hermitian{T,S}(inv(bkfact(A.data, Symbol(A.uplo))), A.uplo) +inv{T<:BlasFloat,S<:StridedMatrix}(A::Symmetric{T,S}) = Symmetric{T,S}(inv(bkfact(A.data, Symbol(A.uplo), true)), A.uplo) eigfact!{T<:BlasReal,S<:StridedMatrix}(A::RealHermSymComplexHerm{T,S}) = Eigen(LAPACK.syevr!('V', 'A', A.uplo, A.data, 0.0, 0.0, 0, 0, -1.0)...) # Because of #6721 it is necessary to specify the parameters explicitly here. diff --git a/base/loading.jl b/base/loading.jl index be19368df684a8..b241871a9fd89b 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -305,7 +305,7 @@ function reload(name::AbstractString) error("use `include` instead of `reload` to load source files") else # reload("Package") is ok - require(symbol(require_modname(name))) + require(Symbol(require_modname(name))) end end @@ -518,7 +518,7 @@ function cache_dependencies(f::IO) n = ntoh(read(f, Int32)) n == 0 && break push!(modules, - (symbol(read(f, n)), # module symbol + (Symbol(read(f, n)), # module symbol ntoh(read(f, UInt64)))) # module UUID (timestamp) end read(f, Int64) # total bytes for file dependencies diff --git a/base/markdown/Markdown.jl b/base/markdown/Markdown.jl index 0ff85d2aa9989f..571a7b82fe3086 100644 --- a/base/markdown/Markdown.jl +++ b/base/markdown/Markdown.jl @@ -33,7 +33,7 @@ license(pkg::AbstractString; flavor = github) = parse_file(Pkg.dir(pkg, "LICENSE license(pkg::Module; flavor = github) = license(string(pkg), flavor = flavor) function mdexpr(s, flavor = :julia) - md = parse(s, flavor = symbol(flavor)) + md = parse(s, flavor = Symbol(flavor)) esc(toexpr(md)) end diff --git a/base/markdown/render/rich.jl b/base/markdown/render/rich.jl index 4d041aafedb2b4..79fbd87beba1a4 100644 --- a/base/markdown/render/rich.jl +++ b/base/markdown/render/rich.jl @@ -22,7 +22,7 @@ end function bestmime(val) for mime in ("text/html", "image/svg+xml", "image/png", "text/plain") - mimewritable(mime, val) && return MIME(symbol(mime)) + mimewritable(mime, val) && return MIME(Symbol(mime)) end error("Cannot render $val to Markdown.") end diff --git a/base/math.jl b/base/math.jl index 1e2fc2c2bb9a92..e644a6b9c83ebc 100644 --- a/base/math.jl +++ b/base/math.jl @@ -71,7 +71,7 @@ macro evalpoly(z, p...) b = :($(esc(p[end-1]))) as = [] for i = length(p)-2:-1:1 - ai = symbol("a", i) + ai = Symbol("a", i) push!(as, :($ai = $a)) a = :(muladd(r, $ai, $b)) b = :($(esc(p[i])) - s * $ai) # see issue #15985 on fused mul-subtract @@ -85,7 +85,7 @@ macro evalpoly(z, p...) :(s = muladd(x, x, y*y)), as..., :(muladd($ai, tt, $b))) - R = Expr(:macrocall, symbol("@horner"), :tt, map(esc, p)...) + R = Expr(:macrocall, Symbol("@horner"), :tt, map(esc, p)...) :(let tt = $(esc(z)) isa(tt, Complex) ? $C : $R end) diff --git a/base/methodshow.jl b/base/methodshow.jl index 3ba293809e43dd..c766cc8dbad760 100644 --- a/base/methodshow.jl +++ b/base/methodshow.jl @@ -44,7 +44,7 @@ function arg_decl_parts(m::TypeMapEntry) file, line = "", 0 if li !== nothing argnames = li.slotnames[1:li.nargs] - s = symbol("?") + s = Symbol("?") decls = Any[argtype_decl(:tvar_env => tv, get(argnames, i, s), m.sig.parameters[i]) for i = 1:length(m.sig.parameters)] if isdefined(li, :def) diff --git a/base/multi.jl b/base/multi.jl index c9ae88918c316b..df24261f5a1582 100644 --- a/base/multi.jl +++ b/base/multi.jl @@ -1219,7 +1219,7 @@ end function addprocs_locked(manager::ClusterManager; kwargs...) params = merge(default_addprocs_params(), AnyDict(kwargs)) - topology(symbol(params[:topology])) + topology(Symbol(params[:topology])) # some libs by default start as many threads as cores which leads to # inefficient use of cores in a multi-process model. diff --git a/base/multidimensional.jl b/base/multidimensional.jl index 2b1127d70d4eb0..7568a7ef13a400 100644 --- a/base/multidimensional.jl +++ b/base/multidimensional.jl @@ -191,8 +191,8 @@ using .IteratorsMD # Specializing for a fixed number of arguments provides a ~25% # improvement over the general definitions in abstractarray.jl for N = 1:5 - args = [:($(symbol(:I, d))) for d = 1:N] - targs = [:($(symbol(:I, d))::Union{Colon,Number,AbstractVector}) for d = 1:N] # prevent co-opting the CartesianIndex version + args = [:($(Symbol(:I, d))) for d = 1:N] + targs = [:($(Symbol(:I, d))::Union{Colon,Number,AbstractVector}) for d = 1:N] # prevent co-opting the CartesianIndex version exs = [:(checkbounds(Bool, size(A, $d), $(args[d]))) for d = 1:N] cbexpr = exs[1] for d = 2:N @@ -489,14 +489,14 @@ end for T in indexes.parameters T <: CartesianIndex ? (M += length(T)) : (M += 1) end - index_length_expr = index <: Colon ? symbol(string("Istride_", N+1)) : :(length(index)) + index_length_expr = index <: Colon ? Symbol(string("Istride_", N+1)) : :(length(index)) quote Cartesian.@nexprs $N d->(I_d = indexes[d]) dimlengths = Cartesian.@ncall $N index_lengths_dim V.parent length(V.indexes)-N+1 I Istride_1 = 1 # strides of the indexes to merge Cartesian.@nexprs $N d->(Istride_{d+1} = Istride_d*dimlengths[d]) idx_len = $(index_length_expr) - if idx_len < 0.1*$(symbol(string("Istride_", N+1))) # this has not been carefully tuned + if idx_len < 0.1*$(Symbol(string("Istride_", N+1))) # this has not been carefully tuned return merge_indexes_div(V, indexes, index, dimlengths) end Cartesian.@nexprs $N d->(counter_d = 1) # counter_0 is the linear index @@ -643,7 +643,7 @@ end $(Expr(:meta, :inline)) stride_1 = 1 @nexprs $N d->(stride_{d+1} = stride_d*size(B, d)) - $(symbol(:offset_, N)) = 1 + $(Symbol(:offset_, N)) = 1 ind = 0 Xc, Bc = X.chunks, B.chunks idxlens = @ncall $N index_lengths B d->I[d] diff --git a/base/multimedia.jl b/base/multimedia.jl index 7a69c1ffbdf2e6..9c159a10ec6e1d 100644 --- a/base/multimedia.jl +++ b/base/multimedia.jl @@ -14,7 +14,7 @@ export Display, display, pushdisplay, popdisplay, displayable, redisplay, immutable MIME{mime} end import Base: show, print, string, convert -MIME(s) = MIME{symbol(s)}() +MIME(s) = MIME{Symbol(s)}() show{mime}(io::IO, ::MIME{mime}) = print(io, "MIME type ", string(mime)) print{mime}(io::IO, ::MIME{mime}) = print(io, mime) @@ -22,14 +22,14 @@ print{mime}(io::IO, ::MIME{mime}) = print(io, mime) macro MIME(s) Base.warn_once("@MIME(\"\") is deprecated, use MIME\"\" instead.") if isa(s,AbstractString) - :(MIME{$(Expr(:quote, symbol(s)))}) + :(MIME{$(Expr(:quote, Symbol(s)))}) else - :(MIME{symbol($s)}) + :(MIME{Symbol($s)}) end end macro MIME_str(s) - :(MIME{$(Expr(:quote, symbol(s)))}) + :(MIME{$(Expr(:quote, Symbol(s)))}) end ########################################################################### @@ -59,7 +59,7 @@ mimewritable(m::AbstractString, x) = mimewritable(MIME(m), x) macro textmime(mime) quote - mimeT = MIME{symbol($mime)} + mimeT = MIME{Symbol($mime)} # avoid method ambiguities with the general definitions below: # (Q: should we treat Vector{UInt8} as a bytestring?) Base.Multimedia.reprmime(m::mimeT, x::Vector{UInt8}) = sprint(writemime, m, x) diff --git a/base/precompile.jl b/base/precompile.jl index 6fa7a99d8f1f98..52cf9c5d897b9d 100644 --- a/base/precompile.jl +++ b/base/precompile.jl @@ -121,7 +121,7 @@ precompile(Base.REPL.REPLDisplay, (Base.REPL.BasicREPL,)) precompile(Base.REPL.REPLDisplay, (Base.REPL.LineEditREPL,)) precompile(Base.REPL.add_history, (Base.REPL.REPLHistoryProvider, Base.LineEdit.PromptState)) precompile(Base.REPL.backend, (Base.REPL.LineEditREPL,)) -precompile(Base.REPL.display, (Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, Base.Multimedia.MIME{symbol("text/plain")}, Int)) +precompile(Base.REPL.display, (Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, Base.Multimedia.MIME{Symbol("text/plain")}, Int)) precompile(Base.REPL.display, (Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, Int)) precompile(Base.REPL.ends_with_semicolon, (ASCIIString,)) precompile(Base.REPL.find_hist_file, ()) @@ -398,7 +398,7 @@ precompile(Libc.strftime, (ASCIIString, Libc.TmStruct)) precompile(Base.string, (Int,)) precompile(Base.strip, (ASCIIString,)) precompile(Base.strwidth, (ASCIIString,)) -precompile(Base.symbol, (SubString{UTF8String},)) +precompile(Base.Symbol, (SubString{UTF8String},)) precompile(Base.sync_begin, ()) precompile(Base.sync_end, ()) precompile(Base.systemerror, (Symbol, Bool)) @@ -423,7 +423,7 @@ precompile(Base.wait, (RemoteChannel,)) precompile(Base.write, (Base.Terminals.TTYTerminal, ASCIIString)) precompile(Base.write, (Base.Terminals.TerminalBuffer, ASCIIString)) precompile(Base.write, (IOBuffer, Vector{UInt8})) -precompile(Base.writemime, (Base.Terminals.TTYTerminal, Base.Multimedia.MIME{symbol("text/plain")}, Int)) +precompile(Base.writemime, (Base.Terminals.TTYTerminal, Base.Multimedia.MIME{Symbol("text/plain")}, Int)) # The following are intended to help speed Pkg.update() precompile(Base.Pkg.Entry.update, (ASCIIString,)) diff --git a/base/reducedim.jl b/base/reducedim.jl index fa2a1e6a1b832f..d3772534cbb0c7 100644 --- a/base/reducedim.jl +++ b/base/reducedim.jl @@ -243,7 +243,7 @@ for (fname, op) in [(:sum, :+), (:prod, :*), (:maximum, :scalarmax), (:minimum, :scalarmin), (:all, :&), (:any, :|)] - fname! = symbol(fname, '!') + fname! = Symbol(fname, '!') @eval begin $(fname!)(f::Function, r::AbstractArray, A::AbstractArray; init::Bool=true) = mapreducedim!(f, $(op), initarray!(r, $(op), init), A) @@ -259,8 +259,8 @@ for (fname, fbase, fun) in [(:sumabs, :sum, :abs), (:sumabs2, :sum, :abs2), (:maxabs, :maximum, :abs), (:minabs, :minimum, :abs)] - fname! = symbol(fname, '!') - fbase! = symbol(fbase, '!') + fname! = Symbol(fname, '!') + fbase! = Symbol(fbase, '!') @eval begin $(fname!)(r::AbstractArray, A::AbstractArray; init::Bool=true) = $(fbase!)($(fun), r, A; init=init) diff --git a/base/replutil.jl b/base/replutil.jl index f8a5745b5d9e32..0eec0bfbdd7c5f 100644 --- a/base/replutil.jl +++ b/base/replutil.jl @@ -129,11 +129,11 @@ function showerror(io::IO, ex::DomainError, bt; backtrace=true) if !code.from_c if code.func in (:log, :log2, :log10, :sqrt) # TODO add :besselj, :besseli, :bessely, :besselk print(io,"\n$(code.func) will only return a complex result if called with a complex argument. Try $(string(code.func))(complex(x)).") - elseif (code.func == :^ && code.file == symbol("intfuncs.jl")) || code.func == :power_by_squaring #3024 + elseif (code.func == :^ && code.file == Symbol("intfuncs.jl")) || code.func == :power_by_squaring #3024 print(io, "\nCannot raise an integer x to a negative power -n. \nMake x a float by adding a zero decimal (e.g. 2.0^-n instead of 2^-n), or write 1/x^n, float(x)^-n, or (x//1)^-n.") elseif code.func == :^ && - (code.file == symbol("promotion.jl") || code.file == symbol("math.jl") || - code.file == symbol(joinpath(".","promotion.jl")) || code.file == symbol(joinpath(".","math.jl"))) + (code.file == Symbol("promotion.jl") || code.file == Symbol("math.jl") || + code.file == Symbol(joinpath(".","promotion.jl")) || code.file == Symbol(joinpath(".","math.jl"))) print(io, "\nExponentiation yielding a complex result requires a complex argument.\nReplace x^y with (x+0im)^y, Complex(x)^y, or similar.") end break diff --git a/base/serialize.jl b/base/serialize.jl index 755311cfc92be8..757cec497ca330 100644 --- a/base/serialize.jl +++ b/base/serialize.jl @@ -26,7 +26,7 @@ const TAGS = Any[ (), Bool, Any, :Any, Bottom, :reserved21, :reserved22, Type, :Array, :TypeVar, :Box, - :lambda, :body, :return, :call, symbol("::"), + :lambda, :body, :return, :call, Symbol("::"), :(=), :null, :gotoifnot, :A, :B, :C, :M, :N, :T, :S, :X, :Y, :a, :b, :c, :d, :e, :f, :g, :h, :i, :j, :k, :l, :m, :n, :o, :p, :q, :r, :s, :t, :u, :v, :w, :x, :y, :z, @@ -527,9 +527,9 @@ function handle_deserialize(s::SerializationState, b::Int32) elseif b == DATATYPE_TAG return deserialize_datatype(s) elseif b == SYMBOL_TAG - return symbol(read(s.io, UInt8, Int(read(s.io, UInt8)::UInt8))) + return Symbol(read(s.io, UInt8, Int(read(s.io, UInt8)::UInt8))) elseif b == LONGSYMBOL_TAG - return symbol(read(s.io, UInt8, Int(read(s.io, Int32)::Int32))) + return Symbol(read(s.io, UInt8, Int(read(s.io, Int32)::Int32))) elseif b == EXPR_TAG return deserialize_expr(s, Int(read(s.io, UInt8)::UInt8)) elseif b == LONGEXPR_TAG diff --git a/base/show.jl b/base/show.jl index 24c85b43b36f4f..bd21f6a5c096a0 100644 --- a/base/show.jl +++ b/base/show.jl @@ -375,7 +375,7 @@ const quoted_syms = Set{Symbol}([:(:),:(::),:(:=),:(=),:(==),:(!=),:(===),:(!==) const uni_ops = Set{Symbol}([:(+), :(-), :(!), :(¬), :(~), :(<:), :(>:), :(√), :(∛), :(∜)]) const expr_infix_wide = Set{Symbol}([:(=), :(+=), :(-=), :(*=), :(/=), :(\=), :(&=), :(|=), :($=), :(>>>=), :(>>=), :(<<=), :(&&), :(||), :(<:), :(=>), :(÷=)]) -const expr_infix = Set{Symbol}([:(:), :(->), symbol("::")]) +const expr_infix = Set{Symbol}([:(:), :(->), Symbol("::")]) const expr_infix_any = union(expr_infix, expr_infix_wide) const all_ops = union(quoted_syms, uni_ops, expr_infix_any) const expr_calls = Dict(:call =>('(',')'), :calldecl =>('(',')'), :ref =>('[',']'), :curly =>('{','}')) @@ -575,7 +575,7 @@ function show_unquoted_quote_expr(io::IO, value, indent::Int, prec::Int) print(io, ":") print(io, value) else - print(io, "symbol(\"", escape_string(s), "\")") + print(io, "Symbol(\"", escape_string(s), "\")") end else if isa(value,Expr) && value.head === :block @@ -773,7 +773,7 @@ function show_unquoted(io::IO, ex::Expr, indent::Int, prec::Int) print(io, head) # type annotation (i.e. "::Int") - elseif is(head, symbol("::")) && nargs == 1 + elseif is(head, Symbol("::")) && nargs == 1 print(io, "::") show_unquoted(io, args[1], indent) @@ -871,7 +871,7 @@ function show_unquoted(io::IO, ex::Expr, indent::Int, prec::Int) parens && print(io, ")") # transpose - elseif (head === symbol('\'') || head === symbol(".'")) && length(args) == 1 + elseif (head === Symbol('\'') || head === Symbol(".'")) && length(args) == 1 if isa(args[1], Symbol) show_unquoted(io, args[1]) else diff --git a/base/simdloop.jl b/base/simdloop.jl index d8fdc5b54792f1..136926e60b4e4c 100644 --- a/base/simdloop.jl +++ b/base/simdloop.jl @@ -25,7 +25,7 @@ end function check_body!(x::Expr) if x.head === :break || x.head == :continue throw(SimdError("$(x.head) is not allowed inside a @simd loop body")) - elseif x.head === :macrocall && x.args[1] === symbol("@goto") + elseif x.head === :macrocall && x.args[1] === Symbol("@goto") throw(SimdError("$(x.args[1]) is not allowed inside a @simd loop body")) end for arg in x.args diff --git a/base/sparse/linalg.jl b/base/sparse/linalg.jl index 8d1451a2d45924..249f224f47f860 100644 --- a/base/sparse/linalg.jl +++ b/base/sparse/linalg.jl @@ -52,7 +52,7 @@ for (f, op, transp) in ((:A_mul_B, :identity, false), (:Ac_mul_B, :ctranspose, true), (:At_mul_B, :transpose, true)) @eval begin - function $(symbol(f,:!))(α::Number, A::SparseMatrixCSC, B::StridedVecOrMat, β::Number, C::StridedVecOrMat) + function $(Symbol(f,:!))(α::Number, A::SparseMatrixCSC, B::StridedVecOrMat, β::Number, C::StridedVecOrMat) if $transp A.n == size(C, 1) || throw(DimensionMismatch()) A.m == size(B, 1) || throw(DimensionMismatch()) @@ -87,11 +87,11 @@ for (f, op, transp) in ((:A_mul_B, :identity, false), function $(f){TA,S,Tx}(A::SparseMatrixCSC{TA,S}, x::StridedVector{Tx}) T = promote_type(TA, Tx) - $(symbol(f,:!))(one(T), A, x, zero(T), similar(x, T, A.n)) + $(Symbol(f,:!))(one(T), A, x, zero(T), similar(x, T, A.n)) end function $(f){TA,S,Tx}(A::SparseMatrixCSC{TA,S}, B::StridedMatrix{Tx}) T = promote_type(TA, Tx) - $(symbol(f,:!))(one(T), A, B, zero(T), similar(B, T, (A.n, size(B, 2)))) + $(Symbol(f,:!))(one(T), A, B, zero(T), similar(B, T, (A.n, size(B, 2)))) end end end diff --git a/base/sparse/sparsevector.jl b/base/sparse/sparsevector.jl index 4600f1a978aab9..9836432c7e749c 100644 --- a/base/sparse/sparsevector.jl +++ b/base/sparse/sparsevector.jl @@ -1516,7 +1516,7 @@ end for isunittri in (true, false), islowertri in (true, false) unitstr = isunittri ? "Unit" : "" halfstr = islowertri ? "Lower" : "Upper" - tritype = :(Base.LinAlg.$(symbol(string(unitstr, halfstr, "Triangular")))) + tritype = :(Base.LinAlg.$(Symbol(string(unitstr, halfstr, "Triangular")))) # build out-of-place left-division operations for (istrans, func, ipfunc) in ( diff --git a/base/sparse/umfpack.jl b/base/sparse/umfpack.jl index 5e6ffd28fa8695..7dcd7748e2580a 100644 --- a/base/sparse/umfpack.jl +++ b/base/sparse/umfpack.jl @@ -425,7 +425,7 @@ function getindex(lu::UmfpackLU, d::Symbol) end for Tv in (:Float64, :Complex128), Ti in UmfpackIndexTypes - f = symbol(umf_nm("free_symbolic", Tv, Ti)) + f = Symbol(umf_nm("free_symbolic", Tv, Ti)) @eval begin function ($f)(symb::Ptr{Void}) tmp = [symb] @@ -441,7 +441,7 @@ for Tv in (:Float64, :Complex128), Ti in UmfpackIndexTypes end end - f = symbol(umf_nm("free_numeric", Tv, Ti)) + f = Symbol(umf_nm("free_numeric", Tv, Ti)) @eval begin function ($f)(num::Ptr{Void}) tmp = [num] diff --git a/base/special/bessel.jl b/base/special/bessel.jl index 6fdb5baae3fd0e..8bfddc08c6c178 100644 --- a/base/special/bessel.jl +++ b/base/special/bessel.jl @@ -92,9 +92,9 @@ end # besselj0, besselj1, bessely0, bessely1 for jy in ("j","y"), nu in (0,1) - jynu = Expr(:quote, symbol(jy,nu)) - jynuf = Expr(:quote, symbol(jy,nu,"f")) - bjynu = symbol("bessel",jy,nu) + jynu = Expr(:quote, Symbol(jy,nu)) + jynuf = Expr(:quote, Symbol(jy,nu,"f")) + bjynu = Symbol("bessel",jy,nu) if jy == "y" @eval begin $bjynu(x::Float64) = nan_dom_err(ccall(($jynu,libm), Float64, (Float64,), x), x) @@ -108,7 +108,7 @@ for jy in ("j","y"), nu in (0,1) end @eval begin $bjynu(x::Real) = $bjynu(float(x)) - $bjynu(x::Complex) = $(symbol("bessel",jy))($nu,x) + $bjynu(x::Complex) = $(Symbol("bessel",jy))($nu,x) @vectorize_1arg Number $bjynu end end @@ -343,7 +343,7 @@ function besselyx(nu::Real, x::AbstractFloat) end for f in ("i", "ix", "j", "jx", "k", "kx", "y", "yx") - bfn = symbol("bessel", f) + bfn = Symbol("bessel", f) @eval begin $bfn(nu::Real, x::Real) = $bfn(nu, float(x)) function $bfn(nu::Real, z::Complex) diff --git a/base/stacktraces.jl b/base/stacktraces.jl index 47db91d98a54e4..c270cb9ab10e9e 100644 --- a/base/stacktraces.jl +++ b/base/stacktraces.jl @@ -42,8 +42,8 @@ An alias for `Vector{StackFrame}` provided for convenience; returned by calls to """ typealias StackTrace Vector{StackFrame} -const empty_sym = symbol("") -const unk_sym = symbol("???") +const empty_sym = Symbol("") +const unk_sym = Symbol("???") const UNKNOWN = StackFrame(unk_sym, Nullable{LambdaInfo}(), unk_sym, -1, empty_sym, -1, true, 0) # === lookup(C_NULL) diff --git a/base/stream.jl b/base/stream.jl index 79bff05207a556..f48706cb40cb74 100644 --- a/base/stream.jl +++ b/base/stream.jl @@ -955,8 +955,8 @@ _fd(x::IOStream) = RawFD(fd(x)) ccall(:jl_uv_handle,Ptr{Void},(Ptr{Void},),x.handle)) for (x,writable,unix_fd,c_symbol) in ((:STDIN,false,0,:jl_uv_stdin),(:STDOUT,true,1,:jl_uv_stdout),(:STDERR,true,2,:jl_uv_stderr)) - f = symbol("redirect_"*lowercase(string(x))) - _f = symbol("_",f) + f = Symbol("redirect_"*lowercase(string(x))) + _f = Symbol("_",f) @eval begin function ($_f)(stream) global $x diff --git a/base/strings/basic.jl b/base/strings/basic.jl index 9bb7dbfa13a160..40193949f42d7f 100644 --- a/base/strings/basic.jl +++ b/base/strings/basic.jl @@ -29,7 +29,7 @@ convert(::Type{Vector{UInt8}}, s::AbstractString) = bytestring(s).data convert(::Type{Array{UInt8}}, s::AbstractString) = bytestring(s).data convert(::Type{ByteString}, s::AbstractString) = bytestring(s) convert(::Type{Vector{Char}}, s::AbstractString) = collect(s) -convert(::Type{Symbol}, s::AbstractString) = symbol(s) +convert(::Type{Symbol}, s::AbstractString) = Symbol(s) ## generic supplied functions ## @@ -42,7 +42,7 @@ getindex{T<:Integer}(s::AbstractString, r::UnitRange{T}) = s[Int(first(r)):Int(l getindex(s::AbstractString, v::AbstractVector) = sprint(length(v), io->(for i in v; write(io,s[i]) end)) -symbol(s::AbstractString) = symbol(bytestring(s)) +Symbol(s::AbstractString) = Symbol(bytestring(s)) sizeof(s::AbstractString) = error("type $(typeof(s)) has no canonical binary representation") diff --git a/base/threadcall.jl b/base/threadcall.jl index fd50221e31ab48..3308d749f2e132 100644 --- a/base/threadcall.jl +++ b/base/threadcall.jl @@ -44,7 +44,7 @@ macro threadcall(f, rettype, argtypes, argvals...) body = wrapper.args[2].args args = Symbol[] for (i,T) in enumerate(argtypes) - arg = symbol("arg$i") + arg = Symbol("arg$i") push!(body, :($arg = unsafe_load(convert(Ptr{$T}, p)))) push!(body, :(p += sizeof($T))) push!(args, arg) diff --git a/base/unicode/utf8proc.jl b/base/unicode/utf8proc.jl index d098ce3c993da7..be517a156bec1e 100644 --- a/base/unicode/utf8proc.jl +++ b/base/unicode/utf8proc.jl @@ -3,7 +3,7 @@ # Various Unicode functionality from the utf8proc library module UTF8proc -import Base: show, ==, hash, string, symbol, isless, length, eltype, start, next, done, convert, isvalid, lowercase, uppercase +import Base: show, ==, hash, string, Symbol, isless, length, eltype, start, next, done, convert, isvalid, lowercase, uppercase export isgraphemebreak @@ -166,7 +166,7 @@ isgraph(c::Char) = (UTF8PROC_CATEGORY_LU <= category_code(c) <= UTF8PROC_CATEGOR for name = ("alnum", "alpha", "cntrl", "digit", "number", "graph", "lower", "print", "punct", "space", "upper") - f = symbol("is",name) + f = Symbol("is",name) @eval begin function $f(s::AbstractString) for c in s diff --git a/base/util.jl b/base/util.jl index 42b96ed70333a7..82a4396c581bcf 100644 --- a/base/util.jl +++ b/base/util.jl @@ -233,7 +233,7 @@ end if blas_vendor() == :openblas64 macro blasfunc(x) - return Expr(:quote, symbol(x, "64_")) + return Expr(:quote, Symbol(x, "64_")) end openblas_get_config() = strip(bytestring( ccall((:openblas_get_config64_, Base.libblas_name), Ptr{UInt8}, () ))) else diff --git a/doc/DocCheck.jl b/doc/DocCheck.jl index ca737f5c1f55cd..a0e7a91d7a47fe 100644 --- a/doc/DocCheck.jl +++ b/doc/DocCheck.jl @@ -99,10 +99,10 @@ function _undocumented_rst() if line[1]=='#' if line[2]!= ' ' continue end else - s = symbol(line) # for submodules: string(:Sort) == "Base.Sort" + s = Symbol(line) # for submodules: string(:Sort) == "Base.Sort" if !isdefined(s) continue end if haskey(FUNCTION_DICT, line) || haskey(MODULE_DICT, line) - m = eval(symbol(getkey(MODULE_DICT, line, "Base"))) + m = eval(Symbol(getkey(MODULE_DICT, line, "Base"))) isdeprecated(m,s) && continue havecount+=1; total+=1; continue end @@ -154,13 +154,13 @@ function gen_undocumented_template(outfile = "$JULIA_HOME/../../doc/UNDOCUMENTED println(out) continue else - s = symbol(line) # for submodules: string(:Sort) == "Base.Sort" + s = Symbol(line) # for submodules: string(:Sort) == "Base.Sort" if !isdefined(s) continue end if haskey(FUNCTION_DICT, line) || haskey(MODULE_DICT, line) continue end if line[1]=='@'; line = line[2:end] end - sym = try eval(symbol(line)) catch :() end + sym = try eval(Symbol(line)) catch :() end if isa(sym, Function) mt = methods(sym) if length(mt) == 1 # easy case diff --git a/doc/manual/metaprogramming.rst b/doc/manual/metaprogramming.rst index 0b193eb099d272..d39d7244b57ba3 100644 --- a/doc/manual/metaprogramming.rst +++ b/doc/manual/metaprogramming.rst @@ -144,13 +144,13 @@ representations together: .. doctest:: - julia> :foo == symbol("foo") + julia> :foo == Symbol("foo") true - julia> symbol("func",10) + julia> Symbol("func",10) :func10 - julia> symbol(:var,'_',"sym") + julia> Symbol(:var,'_',"sym") :var_sym In the context of an expression, symbols are used to indicate access to diff --git a/doc/manual/stacktraces.rst b/doc/manual/stacktraces.rst index 312376674d67d9..570737a43fec07 100644 --- a/doc/manual/stacktraces.rst +++ b/doc/manual/stacktraces.rst @@ -83,13 +83,13 @@ returned by :func:`backtrace`: :eval julia> top_frame.file - symbol("./boot.jl") + Symbol("./boot.jl") julia> top_frame.line 265 julia> top_frame.inlined_file - symbol("") + Symbol("") julia> top_frame.inlined_line -1 diff --git a/doc/stdlib/io-network.rst b/doc/stdlib/io-network.rst index d15d77b19e39c3..b015c535c73743 100644 --- a/doc/stdlib/io-network.rst +++ b/doc/stdlib/io-network.rst @@ -707,7 +707,7 @@ Julia environments (such as the IPython-based IJulia notebook). .. Docstring generated from Julia source - The ``display`` functions ultimately call ``writemime`` in order to write an object ``x`` as a given ``mime`` type to a given I/O ``stream`` (usually a memory buffer), if possible. In order to provide a rich multimedia representation of a user-defined type ``T``\ , it is only necessary to define a new ``writemime`` method for ``T``\ , via: ``writemime(stream, ::MIME"mime", x::T) = ...``\ , where ``mime`` is a MIME-type string and the function body calls ``write`` (or similar) to write that representation of ``x`` to ``stream``\ . (Note that the ``MIME""`` notation only supports literal strings; to construct ``MIME`` types in a more flexible manner use ``MIME{symbol("")}``\ .) + The ``display`` functions ultimately call ``writemime`` in order to write an object ``x`` as a given ``mime`` type to a given I/O ``stream`` (usually a memory buffer), if possible. In order to provide a rich multimedia representation of a user-defined type ``T``\ , it is only necessary to define a new ``writemime`` method for ``T``\ , via: ``writemime(stream, ::MIME"mime", x::T) = ...``\ , where ``mime`` is a MIME-type string and the function body calls ``write`` (or similar) to write that representation of ``x`` to ``stream``\ . (Note that the ``MIME""`` notation only supports literal strings; to construct ``MIME`` types in a more flexible manner use ``MIME{Symbol("")}``\ .) For example, if you define a ``MyImage`` type and know how to write it to a PNG file, you could define a function ``writemime(stream, ::MIME"image/png", x::MyImage) = ...`` to allow your images to be displayed on any PNG-capable ``Display`` (such as IJulia). As usual, be sure to ``import Base.writemime`` in order to add new methods to the built-in Julia function ``writemime``\ . diff --git a/doc/stdlib/strings.rst b/doc/stdlib/strings.rst index a5ea3aaef87544..0adff6cc81ca6a 100644 --- a/doc/stdlib/strings.rst +++ b/doc/stdlib/strings.rst @@ -471,7 +471,7 @@ Tests whether a character is a valid hexadecimal digit, or whether this is true for all elements of a string. -.. function:: symbol(x...) -> Symbol +.. function:: Symbol(x...) -> Symbol .. Docstring generated from Julia source diff --git a/examples/staged.jl b/examples/staged.jl index f7212fe5a86e48..934279fcd56779 100644 --- a/examples/staged.jl +++ b/examples/staged.jl @@ -1,7 +1,7 @@ # This file is a part of Julia. License is MIT: http://julialang.org/license function add_method(gf, an, at, body) - argexs = [Expr(symbol("::"), an[i], at[i]) for i=1:length(an)] + argexs = [Expr(Symbol("::"), an[i], at[i]) for i=1:length(an)] def = quote let __F__=($gf) function __F__($(argexs...)) diff --git a/test/backtrace.jl b/test/backtrace.jl index 3dec42bf6b39f8..e01cf18450bb84 100644 --- a/test/backtrace.jl +++ b/test/backtrace.jl @@ -27,16 +27,16 @@ end # same-file inline eval(Expr(:function, Expr(:call, :test_inline_1), - Expr(:block, LineNumberNode(symbol("backtrace.jl"), 42), - LineNumberNode(symbol("backtrace.jl"), 37), + Expr(:block, LineNumberNode(Symbol("backtrace.jl"), 42), + LineNumberNode(Symbol("backtrace.jl"), 37), Expr(:call, :throw, "foo")))) # different-file inline const absfilepath = OS_NAME == :Windows ? "C:\\foo\\bar\\baz.jl" : "/foo/bar/baz.jl" eval(Expr(:function, Expr(:call, :test_inline_2), - Expr(:block, LineNumberNode(symbol("backtrace.jl"), 99), - LineNumberNode(symbol("foobar.jl"), 666), - LineNumberNode(symbol(absfilepath), 111), + Expr(:block, LineNumberNode(Symbol("backtrace.jl"), 99), + LineNumberNode(Symbol("foobar.jl"), 666), + LineNumberNode(Symbol(absfilepath), 111), Expr(:call, :throw, "foo")))) try diff --git a/test/ccall.jl b/test/ccall.jl index c2e44b1d0024df..ff250bde120030 100644 --- a/test/ccall.jl +++ b/test/ccall.jl @@ -412,8 +412,8 @@ s1 = Struct1(352.39422f23, 19.287577) for (t,v) in ((Complex{Int32},:ci32),(Complex{Int64},:ci64), (Complex64,:cf32),(Complex128,:cf64),(Struct1,:s1)) - fname = symbol("foo"*string(v)) - fname1 = symbol("foo1"*string(v)) + fname = Symbol("foo"*string(v)) + fname1 = Symbol("foo1"*string(v)) @eval begin verbose && println($t) a = copy($v) diff --git a/test/compile.jl b/test/compile.jl index 091990fa52a9ee..7ddba1f4941b48 100644 --- a/test/compile.jl +++ b/test/compile.jl @@ -178,7 +178,7 @@ let module_name = string("a",randstring()) code = """module $(module_name)\nend\n""" write(file_name, code) reload(module_name) - @test typeof(eval(symbol(module_name))) == Module + @test typeof(eval(Symbol(module_name))) == Module deleteat!(LOAD_PATH,1) rm(file_name) end diff --git a/test/core.jl b/test/core.jl index 7c3b65a9b86dda..4e09b7734e4ba6 100644 --- a/test/core.jl +++ b/test/core.jl @@ -3194,9 +3194,9 @@ typealias PossiblyInvalidUnion{T} Union{T,Int} @test_throws TypeError PossiblyInvalidUnion{1} # issue #12569 -@test_throws ArgumentError symbol("x"^10_000_000) +@test_throws ArgumentError Symbol("x"^10_000_000) @test_throws ArgumentError gensym("x"^10_000_000) -@test symbol("x") === symbol("x") +@test Symbol("x") === Symbol("x") @test split(string(gensym("abc")),'#')[3] == "abc" # meta nodes for optional positional arguments diff --git a/test/docs.jl b/test/docs.jl index af58986ea7c24b..33520cd527b6f3 100644 --- a/test/docs.jl +++ b/test/docs.jl @@ -500,7 +500,7 @@ macro m1_11993() end macro m2_11993() - symbol("@m1_11993") + Symbol("@m1_11993") end @doc "This should document @m1... since its the result of expansion" @m2_11993 @@ -642,7 +642,7 @@ end ) # Issue #13905. -@test macroexpand(:(@doc "" f() = @x)) == Expr(:error, UndefVarError(symbol("@x"))) +@test macroexpand(:(@doc "" f() = @x)) == Expr(:error, UndefVarError(Symbol("@x"))) # Undocumented DataType Summaries. @@ -781,7 +781,7 @@ end import Base.Docs: @var, Binding, defined -let x = Binding(Base, symbol("@time")) +let x = Binding(Base, Symbol("@time")) @test defined(x) == true @test @var(@time) == x @test @var(Base.@time) == x diff --git a/test/fft.jl b/test/fft.jl index ef32747382c0d8..1883656947dd95 100644 --- a/test/fft.jl +++ b/test/fft.jl @@ -39,7 +39,7 @@ true_fftd3_m3d[:,:,2] = -15 # use invoke to force usage of CTPlan versions even if FFTW is present for A in (Array,SubArray) for f in (:fft,:ifft,:plan_fft,:plan_ifft) - f_ = symbol(string(f, "_")) + f_ = Symbol(string(f, "_")) @eval begin $f_{T,N}(x::$A{T,N}) = invoke($f, Tuple{AbstractArray{T,N}}, x) $f_{T,N,R}(x::$A{T,N},r::R) = invoke($f,Tuple{AbstractArray{T,N},R},x,r) diff --git a/test/parse.jl b/test/parse.jl index f4ab0017722639..b97aea85062e3c 100644 --- a/test/parse.jl +++ b/test/parse.jl @@ -64,7 +64,7 @@ macro test999_str(args...); args; end @test_throws ParseError parse("sqrt(16)2") @test_throws ParseError parse("x' y") @test_throws ParseError parse("x 'y") -@test parse("x'y") == Expr(:call, :*, Expr(symbol("'"), :x), :y) +@test parse("x'y") == Expr(:call, :*, Expr(Symbol("'"), :x), :y) # issue #8301 @test_throws ParseError parse("&*s") @@ -90,7 +90,7 @@ macro test999_str(args...); args; end # issue #10997 @test parse(":(x.\$f[i])") == Expr(:quote, Expr(:ref, - Expr(symbol("."), :x, + Expr(Symbol("."), :x, Expr(:$, Expr(:call, TopNode(:Expr), QuoteNode(:quote), :f))), @@ -123,7 +123,7 @@ macro test999_str(args...); args; end Expr(:import, :A, :c, :d))) # issue #11332 -@test parse("export \$(symbol(\"A\"))") == :(export $(Expr(:$, :(symbol("A"))))) +@test parse("export \$(Symbol(\"A\"))") == :(export $(Expr(:$, :(Symbol("A"))))) @test parse("export \$A") == :(export $(Expr(:$, :A))) @test parse("using \$a.\$b") == Expr(:using, Expr(:$, :a), Expr(:$, :b)) @test parse("using \$a.\$b, \$c") == Expr(:toplevel, Expr(:using, Expr(:$, :a), @@ -149,7 +149,7 @@ macro test999_str(args...); args; end macro f(args...) end; @f "" """) == Expr(:toplevel, Expr(:macro, Expr(:call, :f, Expr(:..., :args)), Expr(:block,)), - Expr(:macrocall, symbol("@f"), "")) + Expr(:macrocall, Symbol("@f"), "")) # blocks vs. tuples @test parse("()") == Expr(:tuple) @@ -326,8 +326,8 @@ end # pr #13078 @test parse("a in b in c") == Expr(:comparison, :a, :in, :b, :in, :c) @test parse("a||b→c&&d") == Expr(:call, :→, - Expr(symbol("||"), :a, :b), - Expr(symbol("&&"), :c, :d)) + Expr(Symbol("||"), :a, :b), + Expr(Symbol("&&"), :c, :d)) # issue #11988 -- normalize \r and \r\n in literal strings to \n @test "foo\nbar" == parse("\"\"\"\r\nfoo\r\nbar\"\"\"") == parse("\"\"\"\nfoo\nbar\"\"\"") == parse("\"\"\"\rfoo\rbar\"\"\"") == parse("\"foo\r\nbar\"") == parse("\"foo\rbar\"") == parse("\"foo\nbar\"") diff --git a/test/replutil.jl b/test/replutil.jl index 4ccc33052ce871..fd4ca10c06d7f8 100644 --- a/test/replutil.jl +++ b/test/replutil.jl @@ -227,8 +227,8 @@ let err_str, i = reinterpret(EightBitType, 0x54), j = reinterpret(EightBitTypeT{Int32}, 0x54) - err_str = @except_str Symbol() MethodError - @test contains(err_str, "MethodError: no method matching Symbol()") + err_str = @except_str Bool() MethodError + @test contains(err_str, "MethodError: no method matching Bool()") err_str = @except_str :a() MethodError @test contains(err_str, "MethodError: objects of type Symbol are not callable") err_str = @except_str EightBitType() MethodError @@ -250,7 +250,7 @@ let err_str, @test contains(err_str, "MethodError: objects of type Array{Float64,1} are not callable") end @test stringmime("text/plain", FunctionLike()) == "(::FunctionLike) (generic function with 0 methods)" -@test ismatch(r"^@doc \(macro with \d+ method[s]?\)$", stringmime("text/plain", Base.(symbol("@doc")))) +@test ismatch(r"^@doc \(macro with \d+ method[s]?\)$", stringmime("text/plain", Base.(Symbol("@doc")))) method_defs_lineno = @__LINE__ Base.Symbol() = throw(ErrorException("1")) @@ -276,7 +276,7 @@ let err_str, @test sprint(show, which(EightBitTypeT, Tuple{})) == "(::Type{EightBitTypeT{T<:Any}})() at $sp:$(method_defs_lineno + 4)" @test sprint(show, which(EightBitTypeT{Int32}, Tuple{})) == "(::Type{EightBitTypeT{T}}){T}() at $sp:$(method_defs_lineno + 5)" @test sprint(show, which(reinterpret(EightBitTypeT{Int32}, 0x54), Tuple{})) == "(::EightBitTypeT{T<:Any})() at $sp:$(method_defs_lineno + 6)" - @test startswith(sprint(show, which(Base.(symbol("@doc")), Tuple{Vararg{Any}})), "@doc(x...) at boot.jl:") + @test startswith(sprint(show, which(Base.(Symbol("@doc")), Tuple{Vararg{Any}})), "@doc(x...) at boot.jl:") @test startswith(sprint(show, which(FunctionLike(), Tuple{})), "(::FunctionLike)() at $sp:$(method_defs_lineno + 7)") @test stringmime("text/plain", FunctionLike()) == "(::FunctionLike) (generic function with 1 method)" @test stringmime("text/plain", Core.arraysize) == "arraysize (built-in function)" diff --git a/test/serialize.jl b/test/serialize.jl index a9f2949475995b..b702c127585d49 100644 --- a/test/serialize.jl +++ b/test/serialize.jl @@ -74,7 +74,7 @@ end # Symbol create_serialization_stream() do s - gensym(len) = symbol(repeat("A", len)) + gensym(len) = Symbol(repeat("A", len)) smbl = gensym(1) serialize(s, smbl) diff --git a/test/show.jl b/test/show.jl index 250dc2e3668d22..7c3622ad13956c 100644 --- a/test/show.jl +++ b/test/show.jl @@ -163,8 +163,8 @@ end""" # issue #7188 @test sprint(show, :foo) == ":foo" -@test sprint(show, symbol("foo bar")) == "symbol(\"foo bar\")" -@test sprint(show, symbol("foo \"bar")) == "symbol(\"foo \\\"bar\")" +@test sprint(show, Symbol("foo bar")) == "Symbol(\"foo bar\")" +@test sprint(show, Symbol("foo \"bar")) == "Symbol(\"foo \\\"bar\")" @test sprint(show, :+) == ":+" @test sprint(show, :end) == ":end" diff --git a/test/strings/basic.jl b/test/strings/basic.jl index b0258852d45fe1..0683fa48ef0490 100644 --- a/test/strings/basic.jl +++ b/test/strings/basic.jl @@ -41,21 +41,21 @@ end # issue #6027 let # make symbol with invalid char - sym = symbol(Char(0xdcdb)) + sym = Symbol(Char(0xdcdb)) @test string(sym) == string(Char(0xdcdb)) @test expand(sym) === sym res = string(parse(string(Char(0xdcdb)," = 1"),1,raise=false)[1]) @test res == """\$(Expr(:error, "invalid character \\\"\\udcdb\\\"\"))""" end -@test symbol("asdf") === :asdf -@test symbol(:abc,"def",'g',"hi",0) === :abcdefghi0 +@test Symbol("asdf") === :asdf +@test Symbol(:abc,"def",'g',"hi",0) === :abcdefghi0 @test :a < :b @test startswith(string(gensym("asdf")),"##asdf#") @test gensym("asdf") != gensym("asdf") @test gensym() != gensym() @test startswith(string(gensym()),"##") -@test_throws ArgumentError symbol("ab\0") +@test_throws ArgumentError Symbol("ab\0") @test_throws ArgumentError gensym("ab\0") # issue #6949 @@ -176,7 +176,7 @@ gstr = GenericString("12"); @test convert(Array{UInt8}, gstr) ==[49;50] @test convert(Array{Char,1}, gstr) ==['1';'2'] -@test convert(Symbol, gstr)==symbol("12") +@test convert(Symbol, gstr)==Symbol("12") @test getindex(gstr, Bool(1))=='1' @test getindex(gstr,Bool(1):Bool(1))=="1" @@ -187,7 +187,7 @@ gstr = GenericString("12"); @test map(uppercase, "foó") == "FOÓ" @test chr2ind("fóobar",3) == 4 -@test symbol(gstr)==symbol("12") +@test Symbol(gstr)==Symbol("12") @test_throws ErrorException sizeof(gstr) @@ -249,7 +249,7 @@ for T in [BigInt, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int1 end let s = normalize_string("tést",:NFKC) @test bytestring(Base.unsafe_convert(Cstring, s)) == s - @test bytestring(convert(Cstring, symbol(s))) == s + @test bytestring(convert(Cstring, Symbol(s))) == s @test wstring(Base.unsafe_convert(Cwstring, wstring(s))) == s end let s = "ba\0d"