On 18.12.2022 13:12, Sascha Ziemann wrote: > I am wondering if something like bytevector-string-ref is missing in the API. > Or is there any other way to extract a string from a byte vector, without > copying the data twice? >
I don't think Guile currently has any way of giving you a string object that's backed by the contents of a bytevector, instead of a privately held copy of those bytevector contents. AFAIK, there is only the utfX->string class of procedures, which give you a "newly allocated" string from the bytevector's contents: https://www.gnu.org/software/guile/manual/html_node/Bytevectors-as-Strings.html That should only lead to the contents being copied once, however. I'm not sure why you asked "without copying the data twice." -- Taylan