Skip to content

copy byte arrays upon string construction #102

Closed
@StefanKarpinski

Description

@StefanKarpinski

Strings are immutable by interface even though manipulation of their underlying data is not prevented. This violates that abstraction:

julia> bytes = linspace(uint8('A'),uint8('F'))
[65,66,67,68,69,70]

julia> str = ASCIIString(bytes)
"ABCDEF"

julia> bytes[1] += 32
[97,66,67,68,69,70]

julia> str
"aBCDEF"

Here, changing a mutable object affects the state of a string object whose interface is immutable.

Metadata

Metadata

Labels

bugIndicates an unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions