News for hackers. Stuff that matters.
Re:Maintain It with Zig by 10000truths on Wednesday September 08, 2021 @02:43PM (#28461378)
> I've always tried as much as possible to treat strings as just opaque data and never look into them, which tends to work well, but in some domains you really need to look at and massage the characters/codepoints/grapheme clusters, and the lack of a first-citizen UTF-8-aware string type is, I think, a bit unfortunate in this day and age.

You don't need a string type for that, you just need routines that handle UTF-8 strings, like utfcpp (https://github.com/nemtrif/utfcpp).

Re:Maintain It with Zig by moogly on Wednesday September 08, 2021 @02:58PM (#28461560)
Sure, you're not wrong. For my purposes that'd work, but I'm of the opinion that delegating that to an optional library will make a lot of developers lazy and not even bother thinking about Unicode/i18n/l10n issues at all. I've seen so much code, in a multitude of languages that is oblivious to it, but even if it's reified in a type or even having some form of language support, I guess you can argue that people can still ignore it.
Re:Maintain It with Zig by moogly on Wednesday September 08, 2021 @06:29PM (#28463841)
In addition, I should add there are synergy effects in having the community (and the major libraries) settling on a common way, and you'll only really get that if there is a built-in.

However, if the philosophy here is to be unopinionated and optimize for flexibility over everything else, I feel I can't really fault them for making that choice.

Re:Maintain It with Zig by mikepurvis on Wednesday September 08, 2021 @05:41PM (#28463417)
That was basically the state of affairs with strings in Python 2, and although the transition was awful, I'm really, really appreciative of Python 3 now having clearly-separated str and bytes types.
Re:Maintain It with Zig by kristoff_it on Wednesday September 08, 2021 @02:50PM (#28461469)
Agreed, and Zig also has a lib for that as well:

https://github.com/jecolon/ziglyph/

Re:Maintain It with Zig by coldtea on Thursday September 09, 2021 @12:35AM (#28466231)
If it's not a single official library, then this will just end up in a future mess...

Like in any language with any lib that is not self-contained (cuts across all aspects of a program and can be used anywhere) and has many different implementations and no sanctioned one.

Re:Maintain It with Zig by moogly on Wednesday September 08, 2021 @03:01PM (#28461587)
Ooh, haven't come across this. Thanks!