unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Taylan Kammer <taylan.kammer@gmail.com>
To: Sascha Ziemann <ceving@gmail.com>, guile-user@gnu.org
Subject: Re: bytevector-string-ref
Date: Sun, 18 Dec 2022 17:25:16 +0100	[thread overview]
Message-ID: <6b286bd0-1f66-c4d0-dc27-0b5e0fb154b6@gmail.com> (raw)
In-Reply-To: <CAGUt3y7=P0CnHxT+J60tgOvC_+J3c_Zi27rFLBO3CD2M-eV0=Q@mail.gmail.com>

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




  parent reply	other threads:[~2022-12-18 16:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-18 12:12 bytevector-string-ref Sascha Ziemann
2022-12-18 13:19 ` bytevector-string-ref tomas
2022-12-18 16:25 ` Taylan Kammer [this message]
2022-12-18 16:35   ` bytevector-string-ref Vijay Marupudi
2022-12-18 16:38   ` bytevector-string-ref tomas
2022-12-18 21:17 ` bytevector-string-ref Matt Wette
2022-12-18 22:45   ` bytevector-string-ref Sascha Ziemann
2022-12-19  5:01     ` bytevector-string-ref tomas
2022-12-21 15:49       ` bytevector-string-ref Sascha Ziemann
2022-12-22  5:34         ` bytevector-string-ref tomas
2022-12-22  8:58           ` bytevector-string-ref Sascha Ziemann
2022-12-22 12:24             ` bytevector-string-ref lloda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b286bd0-1f66-c4d0-dc27-0b5e0fb154b6@gmail.com \
    --to=taylan.kammer@gmail.com \
    --cc=ceving@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).