(no title)
aDyslecticCrow | 1 month ago
I do agree with the string imutable argument. Mutable and imutable strings have different usecases and design tradeoffs. They perhaps shouldn't be the same type at all.
The transient string is particularly brilliant. Ive worked with some low level networking code in c, and being able to create a string containing the "payload" by pointing directly to an offset in the raw circular packet buffer is very clean. (the alternative is juggling offsets, or doing excessive memcpy)
So beyond the database usecase it's a clever string format.
It would be nice to have an ISO or equivalent specification on it though.
masklinn|1 month ago
It's not anything special? That's just `string_view` (C++17). Java also used to do that as an optimisation (but because it was implicit and not trivial to notice it caused difficult do diagnose memory leaks, IIRC it was introduced in Java 1.4 and removed in 1.7).
aDyslecticCrow|1 month ago
Just because something already exists in some language doesn't make it less clever. It's not very widespread, and it's very powerful when applicable.
This format can handle "string views" with the same logic as "normal strings" without relying on interfaces or inheritance overhead.
it's clever.
tracker1|1 month ago