You can measure the current progress on this migration over on this handy site: https://benwiederhake.github.io/serenity-fixmes/
In December 2022, we decided to move away from our old string class to one that exposes out-of-memory (OOM) errors, and that is always encoded as utf-8. This will prevent some common and subtle issues, allow us to propagate OOM and encoding errors, and make it easier to integrate Jakt with the system.
Similarly, we have an old DeprecatedFlyString
class which is being replaced by a new FlyString
.
Unsurprisingly, there are a LOT of strings all over the place, so if you want to help, pick a small area to convert, maybe a small class or even a few methods at a time.
Things to look out for:
FlyString
from a string literal, use the _fly_string
suffix: auto message = "Well, hello friends!"_fly_string;
FlyString
from other input, use the FlyString::from_utf8(StringView)
or FlyString::from_deprecated_fly_string(DeprecatedFlyString)
factory functions. These returns ErrorOr<FlyString>
, meaning that you need to propagate the error or otherwise deal with it. If it's a situation where you know the source string must be utf-8, feel free to wrap it in MUST(...)
. Otherwise, if possible, make the containing function return ErrorOr<...>
and wrap the String
construction in TRY(...)
. But if not, append .release_value_but_fixme_should_propagate_errors()
so a future contributor can find it.FlyString
has no operator[]
. Processing a string byte-by-byte causes issues since utf-8 encoding may use several bytes for a single character (known as a "code point"). Rather than iterating them byte-by-byte, use the code_points()
method to get a Utf8View
for iterating these code points.FlyString
has no is_null()
state. null
strings represented a string with no value, as opposed to an empty string. Think of it like an empty Optional<FlyString>
. If the code needs to distinguish between these states, use Optional<FlyString>
instead. If not, just use an empty string and is_empty()
.You need to set a limit for how much you will convert in a single commit (or PR). Outside of the area you are working on, you will need to interact with code that still requires or returns a DeprecatedFlyString
. FlyString::to_deprecated_fly_string()
and FlyString::from_deprecated_fly_string(DeprecatedFlyString)
will let you convert from one form to the other.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too