Skip to content

copy not implemented for String #31995

@meggart

Description

@meggart

I just realized this on Julia 1.1 as well as master:

julia> copy("I want to be copied")
ERROR: MethodError: no method matching copy(::String)
Closest candidates are:
  copy(::Expr) at expr.jl:36
  copy(::Core.CodeInfo) at expr.jl:64
  copy(::BitSet) at bitset.jl:46
  ...
Stacktrace:
 [1] top-level scope at REPL[3]:1

I was wondering if this is desired behavior or would if it would be ok to define copy(s::String)=s since Strings are immutable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions