string is rarely useful as a function argument
Timon Gehr
timon.gehr at gmx.ch
Wed Dec 28 11:57:27 PST 2011
On 12/28/2011 06:40 PM, Andrei Alexandrescu wrote:
> On 12/28/11 11:11 AM, Walter Bright wrote:
>> On 12/28/2011 4:06 AM, Peter Alexander wrote:
>>> I rarely *ever* need an immutable string. What I usually need is
>>> const(char)[].
>>> I'd say 99%+ of the time I need only a const string.
>>
>> I have a very different experience with strings. I can't even remember a
>> case where I wanted to modify an existing string (this includes all my C
>> and C++ usage of strings). It's always assemble a string at one place,
>> and then refer to that string ever after (and never modify it).
>>
>> What immutable strings make possible is treating strings as if they were
>> value types. Nearly every language I know of treats them as immutable
>> except for C and C++.
>
> I remember the day at Kahili we figured immutable(char)[] will just work
> as it needs to. It felt pretty awesome.
>
> Andrei
I agree. But I am confused by the fact that you are suggesting it
actually does not work as it needs to at other places in this thread.
More information about the Digitalmars-d
mailing list