toString vs. toUtf8

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Nov 19 13:55:42 PST 2007


"Sean Kelly" <sean at f4.ca> wrote in message 
news:fhsts6$5nn$1 at digitalmars.com...
>
> As an alternative, I can only suggest that toUTF8, toUTF16, and toUTF32 be 
> named toString, toWString, and toDString, respectively, and Unicode should 
> be assumed as the standard encoding format in D.
>

Do you want to know my single overriding reason for wanting toString instead 
of toUtf8?  Because it's nicer-looking and easier to type.

My other reasons include consistency (Java uses .toString, .Net uses 
.ToString, phobos uses .toString) and that "toUtf8" screams "I'm a string 
class and this method converts my encoding!"  while "toString" says "convert 
this object, whatever it is, to some kind of string."

votes += 8 for toString, toWString, and toDString. 





More information about the Digitalmars-d mailing list