Rename std.ctype to std.ascii?

KennyTM~ kennytm at gmail.com
Tue Jun 14 01:24:50 PDT 2011


On Jun 14, 11 14:23, Jonathan M Davis wrote:
> On 2011-06-13 22:48, Jouko Koski wrote:
>> "Jonathan M Davis"<jmdavisProg at gmx.com>  wrote:
>>> std.ctype is modeled after C's ctype.h. It has functions for operating on
>>> characters - particularly functions which indicate the type of a
>>> character (I
>>> believe that ctype stands for character type, so that makes sense). For
>>> instance, isdigit will tell you whether a particular character is a
>>> digit. It
>>> only works on ASCII characters (non-ASCII characters return false for
>>> functions like isdigit and functions like toupper do nothing to non-ASCII
>>> characters).
>>
>> 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.
>
> - Jonathan M Davis

std.ctype does not, but <ctype.h> does. (which could be another reason 
it shouldn't be called std.ctype.)


More information about the Digitalmars-d mailing list