[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `aset` on strings, changing the size in bytes
From: |
Stefan Monnier |
Subject: |
Re: `aset` on strings, changing the size in bytes |
Date: |
Sat, 08 Sep 2018 14:36:46 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> That's not my reading of the code. It doesn't seem to cons a new
> string.
It does not allocate a new Lisp_String object, but it does allocate
a new sdata object. Allocating a new Lisp_Object is not really an
option, because `aset` couldn't return that new object (it has to work
in-place).
> But if I'm mistaken, and the current implementation does cons a new
> string, then what is your problem with it?
The need for an indirection (a String_Object has to hold a pointer to an
sdata object rather than being able to keep its payload directly in the
Lisp_String object (using FLEXIBLE_ARRAY_MEMBER)) and the unexpected
memory allocation behavior (users who aren't privy to the underlying
implementation would never expect a primitive like `aset` to internally
perform a copy of the string's bytes).
Stefan
- Re: `aset` on strings, changing the size in bytes, (continued)
- Re: `aset` on strings, changing the size in bytes, Johan Bockgård, 2018/09/07
- Re: `aset` on strings, changing the size in bytes, Eli Zaretskii, 2018/09/08
- Re: `aset` on strings, changing the size in bytes, Stefan Monnier, 2018/09/08
- Re: `aset` on strings, changing the size in bytes, Eli Zaretskii, 2018/09/08
- Re: `aset` on strings, changing the size in bytes,
Stefan Monnier <=
- Re: `aset` on strings, changing the size in bytes, Eli Zaretskii, 2018/09/08
- Re: `aset` on strings, changing the size in bytes, Stefan Monnier, 2018/09/08
- Re: `aset` on strings, changing the size in bytes, Eli Zaretskii, 2018/09/09
- Re: `aset` on strings, changing the size in bytes, Stefan Monnier, 2018/09/09
- Re: `aset` on strings, changing the size in bytes, Richard Stallman, 2018/09/09
- Re: `aset` on strings, changing the size in bytes, Eli Zaretskii, 2018/09/09
- Re: `aset` on strings, changing the size in bytes, Noam Postavsky, 2018/09/09
- Re: `aset` on strings, changing the size in bytes, Eli Zaretskii, 2018/09/09
- Re: `aset` on strings, changing the size in bytes, Noam Postavsky, 2018/09/09
- Re: `aset` on strings, changing the size in bytes, Richard Stallman, 2018/09/10