diff options
| author | 2026-02-06 13:07:03 -0500 | |
|---|---|---|
| committer | 2026-02-06 13:07:03 -0500 | |
| commit | b823a49b6a57bc1736b33a0816b42aaaf86cf839 (patch) | |
| tree | 533a2ffff737ba2826456fecb01bf3eb187b872a /NEWS.md | |
| parent | Slightly better hash reduction for comptime_map (diff) | |
| download | zg-b823a49b6a57bc1736b33a0816b42aaaf86cf839.tar.gz zg-b823a49b6a57bc1736b33a0816b42aaaf86cf839.tar.xz zg-b823a49b6a57bc1736b33a0816b42aaaf86cf839.zip | |
zg module, casing improvements
Diffstat (limited to 'NEWS.md')
| -rw-r--r-- | NEWS.md | 94 |
1 files changed, 75 insertions, 19 deletions
| @@ -1,5 +1,6 @@ | |||
| 1 | # News | 1 | # News |
| 2 | 2 | ||
| 3 | |||
| 3 | ## zg v0.16.0-pre Release Notes | 4 | ## zg v0.16.0-pre Release Notes |
| 4 | 5 | ||
| 5 | This brings another major change to `zg`, touching basically everything. | 6 | This brings another major change to `zg`, touching basically everything. |
| @@ -24,6 +25,10 @@ I did manage to dispose of one last allocation in `CanonData`, by | |||
| 24 | integrating Vexu's very clever [comptime hash map][chm], so, that's | 25 | integrating Vexu's very clever [comptime hash map][chm], so, that's |
| 25 | nice. | 26 | nice. |
| 26 | 27 | ||
| 28 | [uucode]: https://github.com/jacobsandlund/uucode | ||
| 29 | [chm]: https://github.com/Vexu/comptime_hash_map/blob/master/src/main.zig | ||
| 30 | |||
| 31 | |||
| 27 | ### Migration | 32 | ### Migration |
| 28 | 33 | ||
| 29 | Is simplicity itself: just call the module instead of calling the | 34 | Is simplicity itself: just call the module instead of calling the |
| @@ -33,41 +38,73 @@ disposing of it when you're done with it. | |||
| 33 | Technically the laws of style dictate that, since these are now | 38 | Technically the laws of style dictate that, since these are now |
| 34 | containers, and not instantiable types, they should be lowercased. | 39 | containers, and not instantiable types, they should be lowercased. |
| 35 | 40 | ||
| 36 | I did not do that in the README. But feel free! | 41 | I didn't see the point in changing all those names, it would add labor |
| 42 | to what should be a very brief and pleasant upgrade (but see below). | ||
| 43 | But feel free! | ||
| 37 | 44 | ||
| 38 | Pro tip: use LSP superpowers to rename the instance to the name of the | 45 | Pro tip: use LSP superpowers to rename the instance to the name of the |
| 39 | module, then just delete the initializer. Couldn't be simpler. | 46 | module, then just delete the initializer. Couldn't be simpler. |
| 40 | 47 | ||
| 48 | |||
| 49 | ### zg: The Module | ||
| 50 | |||
| 51 | The take-what-you-need approach, of packaging the interface in a bunch of | ||
| 52 | separate modules, remains available for those who prefer it. | ||
| 53 | |||
| 54 | Or, your code can just import `"zg"`, a module containing all of the | ||
| 55 | other modules. Zig's lazy compilation model gives us take-what-you-need | ||
| 56 | already, so while there's no reason to remove the submodules, there's no | ||
| 57 | reason to prefer using them either. | ||
| 58 | |||
| 59 | As mentioned above, none of these are instance types any longer, and that | ||
| 60 | dictates that they take lower-case (as `code_point` and `ascii` always | ||
| 61 | have, for that reason). So in `zg`, the modules are styled in lower case. | ||
| 62 | |||
| 63 | I did not want to combine a purely stylistic change, and one which would | ||
| 64 | require editing build scripts, with the functional changes needed to use | ||
| 65 | the (much nicer!) allocation-free interface. It is possible that later | ||
| 66 | releases will lowercase the submodules as well, or maybe just remove | ||
| 67 | them in favor of importing `zg`. Then again, maybe not. | ||
| 68 | |||
| 69 | |||
| 41 | ### Emoji Module | 70 | ### Emoji Module |
| 42 | 71 | ||
| 43 | Also Jacob's work. | 72 | Also Jacob's work. Exposes the basic useful Unicode emoji properties. |
| 44 | 73 | ||
| 45 | [uucode]: https://github.com/jacobsandlund/uucode | ||
| 46 | [chm]: https://github.com/Vexu/comptime_hash_map/blob/master/src/main.zig | ||
| 47 | 74 | ||
| 48 | ### graphemeClusterWidth | 75 | ### `graphemeClusterWidth` |
| 49 | 76 | ||
| 50 | @lch361 submitted a minor refactor which makes it cleaner to obtain the | 77 | @lch361 submitted a minor refactor which makes it cleaner to obtain the |
| 51 | display width of a grapheme cluster. Thanks Lich! | 78 | display width of a grapheme cluster. Thanks Lich! |
| 52 | 79 | ||
| 53 | ### The Future | ||
| 54 | 80 | ||
| 55 | I hope I don't jinx it, but this is the last major change I've wanted | 81 | ### Better Fast-pathing in Caseless Comparison |
| 56 | to make to `zg`. I brought it up with José before he handed over | 82 | |
| 57 | maintainence to me, we agreed that compressing and decompressing and | 83 | Caseless comparison only tries the ASCII fast-path when strings are the |
| 58 | heap-allocating was one of those ideas which turned out not to pencil | 84 | same size, which is the only time it can work. The fast path has also |
| 59 | out. Hey, it happens. | 85 | been SIMD accelerated when possible. |
| 86 | |||
| 87 | Canonicalization, and caseless comparision (which uses it), are in need | ||
| 88 | of attention. They do things in the most expensive possible fashion, | ||
| 89 | without taking advantage of any opportunities to do the cheaper thing. | ||
| 90 | While the result is correct, even in pathological cases, it is not | ||
| 91 | optimal, especially given the reality that Unicode text is, in a modern | ||
| 92 | context, nearly always in canonical form already. | ||
| 93 | |||
| 94 | Changes to that will have to wait for another release, despite my | ||
| 95 | inclinations to the contrary. | ||
| 96 | |||
| 97 | |||
| 98 | ### code_point.decode fully deprecated | ||
| 60 | 99 | ||
| 61 | Features? There are few left, sure. Bugfixes? Always, of course. | 100 | Slicing to decode a point is an anti-pattern, and calling this |
| 62 | But major API changes are now unlikely. | 101 | deprecated function is now a `@compileError`, suggesting `decodeAtIndex` |
| 102 | instead. I suggest taking a look at `decodeAtCursor` as well, which | ||
| 103 | takes a pointer to an index and moves it to the next codepoint while | ||
| 104 | decoding, this is often what you want. | ||
| 63 | 105 | ||
| 64 | I have a "no 1.0 until Zig 1.0" policy, because no one can guarantee the | 106 | A future release will remove the function entirely. |
| 65 | stability of anything until that happens. Nor is `zg` actually ready | ||
| 66 | for a stability policy; if I decide to break apart a module, or move | ||
| 67 | something where it makes more sense, I'm going to do that. | ||
| 68 | 107 | ||
| 69 | But it is _likely_ that this is the last 'global' refactor of the | ||
| 70 | library. | ||
| 71 | 108 | ||
| 72 | ## zg v0.15.2-4 Release Notes | 109 | ## zg v0.15.2-4 Release Notes |
| 73 | 110 | ||
| @@ -82,6 +119,7 @@ but we could have vendored it: more importantly, it turned out to be | |||
| 82 | basically useless. Savings per data set were in the bytes to low | 119 | basically useless. Savings per data set were in the bytes to low |
| 83 | KiB range, and startup time was negatively affected. | 120 | KiB range, and startup time was negatively affected. |
| 84 | 121 | ||
| 122 | |||
| 85 | ## zg v0.14.1 Release Notes | 123 | ## zg v0.14.1 Release Notes |
| 86 | 124 | ||
| 87 | In a flurry of activity during and after the `v0.14.0` beta, several | 125 | In a flurry of activity during and after the `v0.14.0` beta, several |
| @@ -92,6 +130,7 @@ Presenting `zg v0.14.1`. As should be expected from a patch release, | |||
| 92 | there are no breaking changes to the interface, just bug fixes and | 130 | there are no breaking changes to the interface, just bug fixes and |
| 93 | features. | 131 | features. |
| 94 | 132 | ||
| 133 | |||
| 95 | ### Grapheme Zalgo Text Bugfix | 134 | ### Grapheme Zalgo Text Bugfix |
| 96 | 135 | ||
| 97 | Until this release, `zg` was using a `u8` to store the length of a | 136 | Until this release, `zg` was using a `u8` to store the length of a |
| @@ -109,6 +148,7 @@ Actually, both fields are now `uoffset`, for reasons described next. | |||
| 109 | 148 | ||
| 110 | [Zalgo]: https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 | 149 | [Zalgo]: https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 |
| 111 | 150 | ||
| 151 | |||
| 112 | ### Limits Section Added to README | 152 | ### Limits Section Added to README |
| 113 | 153 | ||
| 114 | The README now clearly documents that some data structures and iterators | 154 | The README now clearly documents that some data structures and iterators |
| @@ -125,6 +165,7 @@ I believe this to be neither necessary nor sufficient for handling data of | |||
| 125 | that size. But I can't anticipate every requirement, and don't want to | 165 | that size. But I can't anticipate every requirement, and don't want to |
| 126 | preclude it as a solution. | 166 | preclude it as a solution. |
| 127 | 167 | ||
| 168 | |||
| 128 | ### Iterators, Back and Forth | 169 | ### Iterators, Back and Forth |
| 129 | 170 | ||
| 130 | A new contributor, Nemoos, took on the challenge of adding a reverse | 171 | A new contributor, Nemoos, took on the challenge of adding a reverse |
| @@ -158,6 +199,7 @@ of those functions. For codepoints, starting an iterator at either | |||
| 158 | `.offset` or `.offset + .len` will suffice, since the `CodePoint` | 199 | `.offset` or `.offset + .len` will suffice, since the `CodePoint` |
| 159 | iterator is otherwise stateless. | 200 | iterator is otherwise stateless. |
| 160 | 201 | ||
| 202 | |||
| 161 | ### Words Module | 203 | ### Words Module |
| 162 | 204 | ||
| 163 | The [Unicode annex][tr29] with the canonical grapheme segmentation | 205 | The [Unicode annex][tr29] with the canonical grapheme segmentation |
| @@ -173,6 +215,7 @@ segmentation and [line breaking][tr14]. | |||
| 173 | [tr29]: https://www.unicode.org/reports/tr29/ | 215 | [tr29]: https://www.unicode.org/reports/tr29/ |
| 174 | [tr14]: https://www.unicode.org/reports/tr14/ | 216 | [tr14]: https://www.unicode.org/reports/tr14/ |
| 175 | 217 | ||
| 218 | |||
| 176 | #### Runeset Used | 219 | #### Runeset Used |
| 177 | 220 | ||
| 178 | As a point of interest: | 221 | As a point of interest: |
| @@ -190,6 +233,7 @@ transitive dependencies. | |||
| 190 | [UCD]: https://www.unicode.org/reports/tr44/ | 233 | [UCD]: https://www.unicode.org/reports/tr44/ |
| 191 | [Rune]: https://github.com/mnemnion/runeset | 234 | [Rune]: https://github.com/mnemnion/runeset |
| 192 | 235 | ||
| 236 | |||
| 193 | ## zg v0.14.0 Release Notes | 237 | ## zg v0.14.0 Release Notes |
| 194 | 238 | ||
| 195 | This is the first minor point release since Sam Atman (me) took over | 239 | This is the first minor point release since Sam Atman (me) took over |
| @@ -201,12 +245,14 @@ The changes are fairly large, and most user code will need to be updated. | |||
| 201 | The result is substantially streamlined and easier to use, and updating | 245 | The result is substantially streamlined and easier to use, and updating |
| 202 | will mainly take place around importing, creating, and deinitializing. | 246 | will mainly take place around importing, creating, and deinitializing. |
| 203 | 247 | ||
| 248 | |||
| 204 | ### The Great Renaming | 249 | ### The Great Renaming |
| 205 | 250 | ||
| 206 | The most obvious change is on the surface API: more than half of the | 251 | The most obvious change is on the surface API: more than half of the |
| 207 | modules have been renamed. There are no user-facing modules with `Data` | 252 | modules have been renamed. There are no user-facing modules with `Data` |
| 208 | in the name, and some abbreviations have been spelled in full. | 253 | in the name, and some abbreviations have been spelled in full. |
| 209 | 254 | ||
| 255 | |||
| 210 | ### No More Separation of Data and Functionality | 256 | ### No More Separation of Data and Functionality |
| 211 | 257 | ||
| 212 | It is no longer necessary to separately create, for example, a | 258 | It is no longer necessary to separately create, for example, a |
| @@ -222,6 +268,7 @@ This would make user structs larger in some cases, while eliminating a | |||
| 222 | pointer chase. If that isn't a desirable trade off for your code, | 268 | pointer chase. If that isn't a desirable trade off for your code, |
| 223 | read on. | 269 | read on. |
| 224 | 270 | ||
| 271 | |||
| 225 | ### All Allocated Data is Unmanaged | 272 | ### All Allocated Data is Unmanaged |
| 226 | 273 | ||
| 227 | Prior to `v0.14`, all structs which need heap allocation no longer | 274 | Prior to `v0.14`, all structs which need heap allocation no longer |
| @@ -235,6 +282,7 @@ Getting up to speed is a matter of passing the allocator to `deinit`. | |||
| 235 | This change comes courtesy of [lch361](https://lch361.net), in his | 282 | This change comes courtesy of [lch361](https://lch361.net), in his |
| 236 | first contribution to the repo. Thanks Lich! | 283 | first contribution to the repo. Thanks Lich! |
| 237 | 284 | ||
| 285 | |||
| 238 | ### `code_point` Now Unicode-Compliant | 286 | ### `code_point` Now Unicode-Compliant |
| 239 | 287 | ||
| 240 | The `v0.15.x` decoder used a simple, fast, but naïve method to decode | 288 | The `v0.15.x` decoder used a simple, fast, but naïve method to decode |
| @@ -267,6 +315,7 @@ is good for the fetch pipeline, and more ergonomic in many cases. | |||
| 267 | [^1]: A bit more than twice as fast as the standard library for | 315 | [^1]: A bit more than twice as fast as the standard library for |
| 268 | decoding, according to my (limited) benchmarks. | 316 | decoding, according to my (limited) benchmarks. |
| 269 | 317 | ||
| 318 | |||
| 270 | ### DisplayWidth and CaseFolding Can Share Data | 319 | ### DisplayWidth and CaseFolding Can Share Data |
| 271 | 320 | ||
| 272 | Both of these modules use another module to get the job done, | 321 | Both of these modules use another module to get the job done, |
| @@ -276,6 +325,7 @@ It is now possible to initialize them with a borrowed copy of those | |||
| 276 | modules, to make it simpler to write code which also needs the base | 325 | modules, to make it simpler to write code which also needs the base |
| 277 | modules. | 326 | modules. |
| 278 | 327 | ||
| 328 | |||
| 279 | ### Grapheme Iterator Creation | 329 | ### Grapheme Iterator Creation |
| 280 | 330 | ||
| 281 | This is a modest streamlining of how a grapheme iterator is created. | 331 | This is a modest streamlining of how a grapheme iterator is created. |
| @@ -304,6 +354,7 @@ var iter = Graphemes.Iterator.init("stri̵̫̗̗̱̳̼̖͚͉͂̌̈́̓̄͋̇̎͠ͅ | |||
| 304 | 354 | ||
| 305 | If one were to prefer doing so. | 355 | If one were to prefer doing so. |
| 306 | 356 | ||
| 357 | |||
| 307 | ### Initialization vs. Setup | 358 | ### Initialization vs. Setup |
| 308 | 359 | ||
| 309 | Every allocating module now has both an `init` function, which | 360 | Every allocating module now has both an `init` function, which |
| @@ -321,6 +372,7 @@ have been turned `unreachable`, leaving only `error.OutOfMemory`. | |||
| 321 | Encountering any of the other errors would indicate an internal problem, | 372 | Encountering any of the other errors would indicate an internal problem, |
| 322 | so we no longer make user code deal with that unlikely event. | 373 | so we no longer make user code deal with that unlikely event. |
| 323 | 374 | ||
| 375 | |||
| 324 | ### New DisplayWidth options | 376 | ### New DisplayWidth options |
| 325 | 377 | ||
| 326 | A `DisplayWidth` can now be compiled to treat `c0` and `c1` control codes | 378 | A `DisplayWidth` can now be compiled to treat `c0` and `c1` control codes |
| @@ -330,18 +382,21 @@ need to escape control codes to make them visible. Setting these | |||
| 330 | options will let `DisplayWidth` return the correct widths when this | 382 | options will let `DisplayWidth` return the correct widths when this |
| 331 | is done. | 383 | is done. |
| 332 | 384 | ||
| 385 | |||
| 333 | ### Unicode 16.0 | 386 | ### Unicode 16.0 |
| 334 | 387 | ||
| 335 | This updates `zg` to use the latest Unicode edition. This should be | 388 | This updates `zg` to use the latest Unicode edition. This should be |
| 336 | the only change which will change behavior of user code, other than | 389 | the only change which will change behavior of user code, other than |
| 337 | through the use of the new `DisplayWidth` options. | 390 | through the use of the new `DisplayWidth` options. |
| 338 | 391 | ||
| 392 | |||
| 339 | ### Tests | 393 | ### Tests |
| 340 | 394 | ||
| 341 | It is now possible to run all the tests, not just the `unicode-test` | 395 | It is now possible to run all the tests, not just the `unicode-test` |
| 342 | subset. Accordingly, that step is removed, and `zig build test` | 396 | subset. Accordingly, that step is removed, and `zig build test` |
| 343 | runs everything. | 397 | runs everything. |
| 344 | 398 | ||
| 399 | |||
| 345 | #### Allocations Tested | 400 | #### Allocations Tested |
| 346 | 401 | ||
| 347 | Every allocate-able now has a `checkAllAllocationFailures` test. This | 402 | Every allocate-able now has a `checkAllAllocationFailures` test. This |
| @@ -349,6 +404,7 @@ process turned up two bugs. Also discovered were 8,663 allocations, | |||
| 349 | which were reduced to two, these were also being individually freed | 404 | which were reduced to two, these were also being individually freed |
| 350 | on deinit. So that's nice. | 405 | on deinit. So that's nice. |
| 351 | 406 | ||
| 407 | |||
| 352 | #### That's It! | 408 | #### That's It! |
| 353 | 409 | ||
| 354 | I hope you find converting over `zg v0.13` code to be fairly painless | 410 | I hope you find converting over `zg v0.13` code to be fairly painless |