emacs-devel
[Top][All Lists]
Advanced

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

Re: (aset UNIBYTE-STRING MULTIBYTE-CHAR)


From: Stefan Monnier
Subject: Re: (aset UNIBYTE-STRING MULTIBYTE-CHAR)
Date: Thu, 14 Feb 2008 23:27:50 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> Even if the code is very bad, it worked in Emacs 22.
> If it doesn't work in Emacs 23, it's a regression.

If it makes them improve their code, it's an ... improvement.

> The problem here is that (make-string 1 ?a) is a unibyte
> string, but "a" generated by buffer-substring on a multibyte
> buffer is a multibyte string.  The result of concatinating
> them is also multibyte.  So, the multibyteness of strings is
> difficult of expect.

Indeed.  To work around this problem, my locally hacked Emacs
distinguishes between unibyte strings (byte-length < 0), multibyte
strings (byte-length > char-length), and "anybyte" strings (byte-length
= char-length).

> If we are going to inhibit aset on multibyte strings,

We can just inhibit aset if it requires changes the string's byte-length
or multibyte-ness.

> I think we should inhibit aset on any strings to avoid
> a further confusion.

And that's indeed what my locally hacked Emacs does.

>> When weighed against the *very* rare cases where aset is used (let
>> alone the even more rare cases where aset is actually useful and
>> convenient), the choice is trivial (for me anyway).

> Then, shouldn't we start the experiment of inhibitting aset
> on strings just now?

But I do not think we're ready for that.  Maybe 10 years from now...


        Stefan




reply via email to

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