First Impressions

Lionello Lunesu lio at lunesu.remove.com
Mon Oct 2 02:48:08 PDT 2006


Lars Ivar Igesund wrote:
> Walter Bright wrote:
> 
>>> And yet we have "toString" and not "toCharArray" or "toUTF"!
>> True, and some have called for renaming char to utf8. While that would
>> be technically more correct (as toUTF would be, too), it just looks awful.
>>
> 
> Nope, it just looks correct.
> 

I don't think renaming toString to toUTF gets rid of any confusion. 
AFAIK, toString is meant for debugging and char[] should be enough, and 
yet flexible enough for unicode strings.

In fact, "string toString()" would be a good solution too.

---
My 4 reasons for the "string" aliases:

* readability: less [] pairs;
* safety: char[] is not zero-terminated, so lets not pretend there's a 
relation with C's char*. In fact: lets hide any relation;
* clarity: a char[] should not be iterated 1 char at a time, which makes 
it different from an int[].
* consistency: "string toString()"

L.



More information about the Digitalmars-d mailing list