News for hackers. Stuff that matters.
Re:Libgrapheme: A simple freestanding C99 library for Unicode by gigel82 on Tuesday November 15, 2022 @03:20PM (#33614461)
This is interesting, particularly for implementing Intl in JS engines without the mega-heavy ICU. But I wonder how portable it really is.

Sometimes I have to dig very deep to find that what folks call "portable C" is actually POSIX-dependent.

It doesn't appear to be the case after going through the code for a bit, so that's promising.

Re:Libgrapheme: A simple freestanding C99 library for Unicode by mananaysiempre on Tuesday November 15, 2022 @04:03PM (#33614972)
You can also refer to the Unicode routines of other small JS engines[1,2], those don’t use ICU either, although the implementations are mercilessly size-optimized (to put it politely) and restricted to what the target JS version requires (e.g. casemapping but no normalization).

[1] https://github.com/bellard/quickjs/blob/master/libunicode.c

[2] https://github.com/svaarala/duktape/blob/master/src-input/du...

Re:Libgrapheme: A simple freestanding C99 library for Unicode by dochtman on Tuesday November 15, 2022 @05:33PM (#33616086)
Maybe a comparison to ICU4X is more interesting.
Re:Libgrapheme: A simple freestanding C99 library for Unicode by layer8 on Tuesday November 15, 2022 @10:20PM (#33618401)
The functionality they’re implementing is purely string/byte processing, I don’t see what should introduce use of non-POSIX features.
Re:Libgrapheme: A simple freestanding C99 library for Unicode by dmitriid on Wednesday November 16, 2022 @03:08AM (#33620309)
> This is interesting, particularly for implementing Intl in JS engines without the mega-heavy ICU.

On the contrary, every single programming language and platform should by default include ICU and provide easy bindings to its functionality. Because even normalization and equality comparisons are often done poorly or not at all in these "simple" libraries.

Re:Libgrapheme: A simple freestanding C99 library for Unicode by hnfong on Wednesday November 16, 2022 @01:07PM (#33627683)
To the contrary I think ICU should be better handled as a "third party" library.

It gets updated quite often, and changes between versions can be substantial. If the developer cares about correctness, they need to have explicit control over the actual version of ICU they're bundling, instead of having the language/platform dealing with it as a black box.

It can be argued that in such cases they can always bundle their own custom version, but then the argument boils down to whether it's better to assure the developer that it works automagically even though it's only correct 99% of the time, or whether to not provide a default implementation and risk them choosing to implement a poor one themselves?