|
|
|
|
|
by aDyslecticCrow
165 days ago
|
|
Interesting to see a deepdive about string formats. I hadn't thought very deeply about it before. 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. |
|
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).