Proposal for fixing dchar ranges

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Mar 12 09:53:24 PDT 2014


On 3/12/14, 6:24 AM, Ary Borenszweig wrote:
> On 3/10/14, 3:30 PM, Walter Bright 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.
>
> You can also look at Erlang, where strings are just lists of numbers.
> Eventually they realized it was a huge mistake and introduced another
> type, a binary string, which is much more efficient and works as expected.
>
> I think making strings behave like arrays is a design mistake.

Erlang's mistake was different from what you believe was D's mistake. 
There is no comparison to be drawn.

Andrei



More information about the Digitalmars-d mailing list