bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#49944: parse-partial-sexp fails to signal an error when (> START LIM


From: Lars Ingebrigtsen
Subject: bug#49944: parse-partial-sexp fails to signal an error when (> START LIMIT).
Date: Wed, 11 Aug 2021 13:04:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> So I don't understand what it is you're proposing: if we document 
>> that OLDSTATE should be the state at FROM, then we need to change the
>> code so that it never swaps FROM and TO.  And if we don't want to change
>> the code, then we should document that OLDSTATE will be used as the
>> state at TO when TO is smaller than FROM.
>
> The latter.  By documenting the expectations of the function, we leave
> it to the callers to make sure their code works as intended.

I think that sounds like a very complicated interface -- it would be
better if we didn't swap.

However, there may well be code out there today that calls the function
with OLDSTATE matching the point passed in by END, which is then swapped
with START (because it's smaller), and things work by accident.

Probably unlikely, but to detect this we'd have to signal an error, like
Alan suggested originally.  So...  perhaps we should just do that?
I.e., signal an error if END is smaller than START?  (And we could fix
up the swapping for clarity, but it wouldn't be necessary.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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