D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2718 - Inconsistent string parameters in Phobos functions
Summary: Inconsistent string parameters in Phobos functions
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: Andrei Alexandrescu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-09 10:11 UTC by Don
Modified: 2015-06-09 01:21 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 Don 2009-03-09 10:11:27 UTC
Some trivial inconsistencies in Phobos functions.
Some of them are quite annoying.

std.utf:
string toUTF8(string s);  -> string toUTF8(const(char)[] s);

std.string:
const(char)* toStringz(const(char)[] s); 
      -> immutable(char)* toStringz(const(char)[] s);

(Returning a const is always suspicious).

std.stream:
void write(char[] s); -> void write(const(char)[] s); 
size_t printf(char[] format,...);  -> size_t printf(const(char)[] format,...);

std.encoding:
abstract const string toString(); -> abstract string toString();
Comment 1 Andrei Alexandrescu 2010-09-26 14:20:33 UTC
Fixed: http://www.dsource.org/projects/phobos/changeset/2060