V2 string

Walter Bright newshound1 at digitalmars.com
Thu Jul 5 12:01:18 PDT 2007


Derek Parnell wrote:
>> This should do it nicely:
>>
>> 	text = null;
> 
> Not really. I want an empty text and not a non-text.

Such a distinction is critical in C code, but is not of much use in D 
code. What do you need the distinction for?

> Also, it doesn't fit
> right with other data types - the consistency thing again.
> 
>    text = typeof(text).init; 
> 
> works better for me because I can also use this construct in templates
> without problems.

The .init for char[] is null, not "".

> But really, this thread can die now. I didn't mean to go off into weird
> tangental subects.

I think you've raised a couple of very important stylistic issues, and 
it is worth pursuing.



More information about the Digitalmars-d mailing list