D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3313 - Check when immutability is really needed in std.string
Summary: Check when immutability is really needed in std.string
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: Andrei Alexandrescu
URL:
Keywords:
Depends on: 3312
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-11 08:22 UTC by David Simcha
Modified: 2015-06-09 01:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2009-09-11 08:22:39 UTC
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 David Simcha 2009-09-11 08:24:03 UTC
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 Andrei Alexandrescu 2011-01-10 16:52:27 UTC
Fixed in http://www.dsource.org/projects/phobos/changeset/2298