Regarding hex strings

foobar foo at bar.com
Thu Oct 18 03:17:05 PDT 2012


On Thursday, 18 October 2012 at 10:11:14 UTC, foobar wrote:
> On Thursday, 18 October 2012 at 10:05:06 UTC, bearophile wrote:
>> The docs say:
>> http://dlang.org/lex.html
>>
>>>Hex strings allow string literals to be created using hex 
>>>data. The hex data need not form valid UTF characters.<
>>

This is especially a good reason to remove this feature as it 
breaks the principle of least surprise and I consider it a major 
bug, not a feature.

I expect D's strings which are by definition Unicode to _only_ 
ever allow _valid_ Unicode. It makes no sense what so ever to 
allow this nasty back-door. Other text encoding should be either 
stored and treated as binary data (ubyte[]) or better yet stored 
in their own types that will ensure those encodings' invariants.


More information about the Digitalmars-d mailing list