GNU bug report logs - #58669
28.2; bindat: str and strz not operating on vectors

Previous Next

Package: emacs;

Reported by: Nacho Barrientos <nacho.barrientos <at> cern.ch>

Date: Thu, 20 Oct 2022 20:11:02 UTC

Severity: normal

Found in version 28.2

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #22 received at 58669 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 58669 <at> debbugs.gnu.org, nacho.barrientos <at> cern.ch
Subject: Re: bug#58669: 28.2; bindat: str and strz not operating on vectors
Date: Fri, 21 Oct 2022 20:16:24 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: 58669 <at> debbugs.gnu.org,  nacho.barrientos <at> cern.ch
> Date: Fri, 21 Oct 2022 12:47:37 -0400
> 
> >> Yes, I'm actually surprised I left this code in there as-is because
> >> I remember wondering how to make a unibyte string from a vector of bytes
> >> in an efficient way (and concluding that there's currently no good way
> >> to do that :-( ).
> >
> > Maybe I'm missing something, but what's wrong with
> >
> >   (apply 'string (append VECTOR nil))
> 
> `append` takes the vector, turns it into a list (thus allocating N cons
> cells), then `apply` turns the list back into an on-stack "vector", and
> all of that just to create a 4x or 8x smaller string.  It's silly.

It gets the job done, doesn't it?




This bug report was last modified 2 years and 212 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.