[Top][All Lists]

[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

> 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).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]