emacs-devel
[Top][All Lists]
Advanced

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

Re: master 49e243c0c85: Avoid resizing mutation in subst-char-in-string,


From: Mattias Engdegård
Subject: Re: master 49e243c0c85: Avoid resizing mutation in subst-char-in-string, take two
Date: Wed, 15 May 2024 19:29:04 +0200

15 maj 2024 kl. 14.40 skrev Eli Zaretskii <eliz@gnu.org>:

> One important use case where this is not rare at all is when replacing
> characters from the same Unicode block (= "script").

It is very rare to see replacement exclusively confined to single block, except 
for block 0 (ASCII). Scripts, even Latin, generally transcend blocks and even 
planes. Text written in one script also tends to include characters from blocks 
not related to that script, such as symbols, spaces, combining marks, numerals 
etc.

The usefulness of equal-length multibyte `aset` is very small, and given how 
rare string mutation is in general, this makes it just not worth taking into 
account. Clear, simple and predictable rules are far more important.

One reason why single-character multibyte replacement (`aset`, 
`subst-char-in-string`, `store-substring`, most of the cl-lib functions etc) is 
so rare is that in the world of Unicode, a 'character' can be a sequence of 
scalar values (combining chars, modifiers etc) so a one-for-one value 
replacement is just too inflexible and limiting.




reply via email to

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