New std.uni: ready for more beating

Dmitry Olshansky dmitry.olsh at gmail.com
Mon Feb 25 10:21:57 PST 2013


25-Feb-2013 22:08, tn пишет:
> Hi. Just a couple stupid questions:
>
> * What is the relation between std.uni and std.utf? Why is two modules
> needed? Seems confusing to me. Shouldn't these be combined? If not, then
> please explain the the distinction in the beginning of the module
> documentation.

std.uni was the C's "ctype" of the Unicode. Except it failed to deliver 
even this starting with about Unicode 5.1.

std.utf is all about encoding/decoding UTF-8, UTF-16. If I were 
designing it from scratch (and what the hell I might one day have to)
I'd put these into std.encoding or even std.encoding.utf.

I'd probably put a small note that basic encoding is both:
a) built-in into the language (foreach)
b) to be found in std.utf

>
> * Shouldn't the module be renamed to std.unicode?

Good idea. But part of the reason was fixing the existing std.uni to:
a) let it work in Unicode 6.1 world (and even 6.2 as of now)
b) make it faster when dealing with Unicode code points in all of the 
isAlpha etc. functions.
c) add a bunch of new cool tools for Unicode

Basically the API is a superset of the existing one. I didn't want to 
change the name.

> We do not have
> std.arr, std.alg or std.cont either. To me, it is not at all obvious
> what std.uni contains based on the module name.

What can I say Phobos is an example of software evolution ;)


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list