emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `aset` on strings, changing the size in bytes


From: Richard Stallman
Subject: Re: `aset` on strings, changing the size in bytes
Date: Sun, 09 Sep 2018 02:07:15 -0400

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > But if I'm mistaken, and the current implementation does cons a new
  > string, then what is your problem with it?  The original string is not
  > mutable, it's just replaced wit ha new one.

"Replaced with the new one" requires relocatable strings.

But suppose we made a function like aset which returned
the string.  That way, it could return a new string when necessary.
It would be used like

   (setq s (sset s idx newchar))

Or we could define it to replace a substring:

   (setq s (srep s from to newsubstring))

It could also accept a regexp as FROM
and a match-string number as TO.  srep would always
make a new string, and nsrep would modify a string in place
if that is possible.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





reply via email to

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