toString vs. toUtf8

Bill Baxter dnewsgroup at billbaxter.com
Tue Nov 20 15:51:24 PST 2007


Sean Kelly wrote:
> 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.

1) On the question of toWString vs toWstring and consistency:

I don't think there's any clear precedent for either in Tango right now, 
but my question is, if tango *had* a "to uint" function, what would it 
be named?  toUInt or toUint?  Whatever the answer to that is should be 
the same as the answer to how to name a "to wstring" function.

2) On the question of toWString vs toStringW

It seems to be pretty well agreed in this thread that toWString is more 
consistent but toStringW is prettier.

I could be wrong but I think usage pattern of these W and D variants of 
the functions will be bimodal:  either very frequent or very infrequent. 
  In the former case I'd probably want to make a simpler alias like 
'wstr'.  In the latter case I'd want it to be the most consistent thing 
possible to be easy to remember for the few times I use it.

--bb



More information about the Digitalmars-d mailing list