Bug 3313 – Check when immutability is really needed in std.string

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2009-09-11T08:22:00Z
Last change time
2015-06-09T01:26:49Z
Assigned to
andrei
Creator
dsimcha
Depends on
3312

Comments

Comment #0 by dsimcha — 2009-09-11T08:22:39Z
This is a meta-bug. In std.string, there are a lot of functions that demand immutable arguments when they don't really need a guarantee that noone else has a mutable view of the string, and thus, const arguments would do just fine. Fixing this would make the const system seem like much of a straight jacket to newcomers without reducing safety.
Comment #1 by dsimcha — 2009-09-11T08:24:03Z
Forgot to mention, for stuff that returns some kind of string, array of strings, etc. that are aliased to the original, templates should probably be used to give the same guarantees about mutability that the original string had.
Comment #2 by andrei — 2011-01-10T16:52:27Z