On Mon, 10 Mar 2014 14:30:07 -0400, Walter Bright
<[email protected]> wrote:
On 3/10/2014 6:35 AM, Steven Schveighoffer wrote:
An idea to fix the whole problems I see with char[] being treated
specially by
phobos: introduce an actual string type, with char[] as backing, that
is a dchar
range, that actually dictates the rules we want. Then, make the
compiler use
this type for literals.
Proposals to make a string class for D have come up many times. I have a
kneejerk dislike for it. It's a really strong feature for D to have
strings be an array type, and I'll go to great lengths to keep it that
way.
BTW, this escaped my view the first time reading your post, but I am NOT
proposing a string *class*. In fact, I'm not proposing we change anything
technical about strings, the code generated should be basically identical.
What I'm proposing is to encapsulate what you can and can't do with a
string in the type itself, instead of making the standard library flip
over backwards to treat it as something else when the compiler treats it
as a simple array of char.
-Steve