[Top][All Lists]

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

Re: 31395511: "Don’t attempt to modify constant strings"

From: Basil L. Contovounesios
Subject: Re: 31395511: "Don’t attempt to modify constant strings"
Date: Thu, 04 Jun 2020 12:11:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Pip Cet <pipcet@gmail.com> writes:

> Paul Eggert <eggert@cs.ucla.edu> writes:
>> On second thought, I'll work on coming up with a better workaround for the
>> problem along the lines I suggested in my previous message:
>> make-text-button can
>> copy the button label string only if the string's not mutable. I hope
>> this helps
>> with SLY (as I hope SLY is not trying to modify string literals...).
> It is. I'm not sure the copy-sequence-unless-mutable semantics really
> make sense, though, as that might make bugs such as this one even harder
> to find.
> I think we should add a new function with clean semantics, and throw an
> error in the old function if the string isn't "mutable", whatever that
> means in this context. (I guess I can't modify the string contents or
> add text properties, but can I modify existing properties?  What about
> cons cells deep within the properties? If they're recursively immutable,
> what about markers and other objects that change state behind your
> back?)

How would make-text-button detect whether its first argument is mutable?
Would it not suffice to clarify in its documentation that it modifies
its argument, in the same way that we warn about passing immutable lists
to nconc?


reply via email to

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