Skip to content

v2.2.0

@zorael zorael tagged this 27 Jan 14:08
This release adds several new features, and as such bumps the minor version.

Added `lu.traits.udaIndexOf`, upstreamed from importing projects.
It functions the same as `std.traits.hasUDA` in that you can use it to
tell whether a symbol is annotated with some attribute, but it incurs
less template bloat and lowers compilation memory required. As the name
implies, unlike `hasUDA` it returns the index of the attribute, or `-1`
if it doesn't exist, so it's not a direct drop-in replacement.

Added `lu.traits.stringOfTypeOf`, upstreamed from importing projects.
A simple template that aliases itself to the string name of a passed type,
or the string name of the type of a passed symbol.

Added `lu.array.zero`, upstreamed from importing projects. It allows for
zeroing out the internal `.data` array of a `std.array.Appender`.
This can be useful if these contain indirections, such as an
`Appender!(string[])` does, as a built-in call to `.clear()` would never
null the pointers, and the memory referenced would be considered live by
the garbage collector.

Added `lu.string.replaceFromAA`, upstreamed from importing projects.
It replaces all occurrences of `$tokens` in a string with values from an
associative array. The associative array must be keyed by the token
strings, and have values in the form of delegates (or functions) that in
turn return replacement strings. This is useful if you want to replace
many tokens in a string at the same time, and when organising them into
an associative array makes sense.

`lu.container.RehashingAA` was fleshed out, and while it can't be called
fully complete, it is now much more useful. Notably you can't `foreach`
over one as the `opApply` function isn't implemented, but the `.byKey`,
`.byValue` and `.byKeyValue` properties are in place and should in the
majority of cases be enough. If it isn't, you can always access the
underlying internal associative array directly via the `.aaOf` escape hatch.

* Refactored `escapeControlCharacters` and `removeControlCharacters` to
  copy (chunks of) the input string by slice instead of
  character-by-character
* Converted many template constraints into static asserts with
  descriptive messages
* Miscellaneous code cleanup
Assets 2