Random string samples & unicode - Reprise

bearophile bearophileHUGS at lycos.com
Sun Sep 12 19:22:02 PDT 2010


Andrei Alexandrescu:

> No, you end up having string-processing code dealing with ranges of 
> dchar.

Well, in several situations it's better to produce a real string/dstring. Even in Haskell, that is designed to manage lazy computation well, you sometimes create eager lists/arrays to simplify the types or the code or to make the code more deterministic.


> If you want to keep the 
> comparison with Python complete, Python's support for Unicode also needs 
> to be part of the discussion.

Right. My code was written in Python 2.x. In Python 3.x the situation is different, all strings are Unicode on default (they are all UTF 16 or UTF 32 according to the way you have compiled CPython) (and there is a built-in bytearray, that is an array of bytes that in some situations is seen as an ASCII string). So in Python it's like using dstrings everywere (in Python there's no char type, it's a string of length 1) or using lazy generators of them.

Bye,
bearophile


More information about the Digitalmars-d mailing list