[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?
--
Basil
- Re: 31395511: "Don’t attempt to modify constant strings", (continued)
- Re: 31395511: "Don’t attempt to modify constant strings", Pip Cet, 2020/06/03
- Re: 31395511: "Don’t attempt to modify constant strings", Basil L. Contovounesios, 2020/06/03
- Re: 31395511: "Don’t attempt to modify constant strings", João Távora, 2020/06/03
- Re: 31395511: "Don’t attempt to modify constant strings", Paul Eggert, 2020/06/03
- Re: 31395511: "Don’t attempt to modify constant strings", Paul Eggert, 2020/06/03
- Re: 31395511: "Don’t attempt to modify constant strings", Pip Cet, 2020/06/04
- Re: 31395511: "Don’t attempt to modify constant strings",
Basil L. Contovounesios <=
- Re: 31395511: "Don’t attempt to modify constant strings", Paul Eggert, 2020/06/04
- Re: 31395511: "Don’t attempt to modify constant strings", João Távora, 2020/06/04
- Re: 31395511: "Don’t attempt to modify constant strings", Paul Eggert, 2020/06/04
- RE: 31395511: "Don’t attempt to modify constant strings", Drew Adams, 2020/06/04
- Re: 31395511: "Don’t attempt to modify constant strings", Pip Cet, 2020/06/04
- Re: 31395511: "Don’t attempt to modify constant strings", Stefan Monnier, 2020/06/04
- Re: 31395511: "Don’t attempt to modify constant strings", Pip Cet, 2020/06/04
- Re: 31395511: "Don’t attempt to modify constant strings", Paul Eggert, 2020/06/04
- Re: 31395511: "Don’t attempt to modify constant strings", Clément Pit-Claudel, 2020/06/04
- Re: 31395511: "Don’t attempt to modify constant strings", Paul Eggert, 2020/06/05