Rename std.ctype to std.ascii?

Daniel Gibson metalcaedes at gmail.com
Tue Jun 14 12:36:35 PDT 2011


Am 14.06.2011 21:29, schrieb Timon Gehr:
> Daniel Gibson wrote:
>> Am 14.06.2011 20:58, schrieb Andrej Mitrovic:
>>> Why does std.ctype exist anyway? Can't you use std.uni for both ASCII
>>> and UTF? Or is there some overhead in using the uni functions?
>>
>> I haven't looked at either implementation, but on ASCII everything is
>> really simple.. isalpha, isdigit, isupper and islower are just a simple
>> checks if the value is between two values, tolower(dchar c) is just
>> return isupper(c) ? c+32 : c; etc.
>> For Unicode this is most probably *much* harder (=> more expensive).
>>
>> Cheers,
>> - Daniel
> 
> The implementation of toUniLower shortcuts on ASCII characters. I don't expect it
> to be any slower if not for inlineability. And if somebody really needs the speed,
> I feel manually writing if('A' <= c && c <= 'Z') c+=32; (or similar) is just good
> enough.
> 
> 
> Timon

OK. I just looked at the implementation and it seems like there are
ASCII-shortcuts in all those unicode functions.
So I agree with Andrej, stc.ctype isn't really needed.

Cheers,
- Daniel


More information about the Digitalmars-d mailing list