Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider String constructor emptying its argument #49711

Closed
jariji opened this issue May 10, 2023 · 3 comments
Closed

Reconsider String constructor emptying its argument #49711

jariji opened this issue May 10, 2023 · 3 comments

Comments

@jariji
Copy link
Contributor

jariji commented May 10, 2023

String(::Vector{UInt8}) empties its argument, which is documented behavior but still very surprising.

I'm not sure if there is a possible path to changing APIs like this in 1.x, but it could help users avoid surprises.

Discussion at https://discourse.julialang.org/t/constructing-string-x-vector-uint8-empties-the-vector/58816

@KristofferC
Copy link
Member

Why do you think the current situation is the way it is?

@jariji
Copy link
Contributor Author

jariji commented May 10, 2023

Sometimes it's hard to tell from the outside. If this is considered a problem, some measures to communicate that to users, short of 1.x breaking removal, might be

  • Adding a !!! warning in the docs
  • deprecating the existing method and recommending an explicitly mutating function
  • Adding a 2.0 milestone

@jakobnissen
Copy link
Member

Duplicate of #32528, in which you can find more discussion, and in which is already on the Julia 2.0 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants