Rename std.ctype to std.ascii?

David Nadlinger see at klickverbot.at
Tue Jun 14 01:51:21 PDT 2011


On 6/14/11 8:23 AM, Jonathan M Davis wrote:
>> What is your definition for ASCII character?
>>
>> Most of the<ctype.h>  functions (or macros) are locale dependent, see
>> setlocale() and<locale.h>. And there is the<wctype.h>, too.
>>
>> While the C standardized ways of doing things might not be most appropriate
>> approach in D domain, we must not base our design decisions on deficient
>> analysis. "I just want this text uppercase" is one of the hardest things in
>> the _world_. The problem is not just the header or package naming.
>
> ??? std.ctype does _nothing_ with localization. And even if it did, that
> doesn't change what ASCII is. ASCII is made up of the values 0 through 127.
> And honestly, I have no clue how _those_ characters could be affected by
> locale. Extended-ASCII might be, but I wouldn't think that ASCII would be.
> Regardless, std.ctype does nothing with locale.

But the functions in <ctype.h> do. And there can be some 
locale-dependent problems even if you use only ASCII, the most prominent 
being the different handling of »i« in the Turkish locale: 
http://www.i18nguy.com/unicode/turkish-i18n.html

This is probably another reason why it shouldn't be called std.ctype…

David


More information about the Digitalmars-d mailing list