unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 13fe8a2: Fix rare undefined behaviors in replace-match
       [not found] ` <20190803200034.9E5F1209B1@vcs0.savannah.gnu.org>
@ 2019-08-03 20:07   ` Lars Ingebrigtsen
  2019-08-03 20:30     ` Paul Eggert
  2019-08-03 21:02     ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-03 20:07 UTC (permalink / raw)
  To: emacs-devel; +Cc: Paul Eggert

eggert@cs.ucla.edu (Paul Eggert) writes:

> +	xsignal2 (Qerror,
> +		  build_string ("replace-match subexpression does not exist"),
> +		  subexp);

This is probably a better error to signal here for this error, but it
possibly changes the behaviour.  If somebody previously had
condition-case'd this for args-out-of-range, then they'll get a new
error signalled now (which is why I kept that signal)...

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: master 13fe8a2: Fix rare undefined behaviors in replace-match
  2019-08-03 20:07   ` master 13fe8a2: Fix rare undefined behaviors in replace-match Lars Ingebrigtsen
@ 2019-08-03 20:30     ` Paul Eggert
  2019-08-03 21:02     ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2019-08-03 20:30 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars Ingebrigtsen wrote:
> This is probably a better error to signal here for this error, but it
> possibly changes the behaviour.  If somebody previously had
> condition-case'd this for args-out-of-range, then they'll get a new
> error signalled now (which is why I kept that signal)...

In this particular case the error is so rare and the signal so inappropriate for 
the error that I thought it better to make the signal more accurate. It's 
possible for (replace-match ... N) to work for N equal to 0, 1, 3, and 4 but to 
signal an error for other N, so signaling an args-out-of-range error when N=2 
would be misleading.

Another possibility would be to signal a domain error when N=2 in that example.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: master 13fe8a2: Fix rare undefined behaviors in replace-match
  2019-08-03 20:07   ` master 13fe8a2: Fix rare undefined behaviors in replace-match Lars Ingebrigtsen
  2019-08-03 20:30     ` Paul Eggert
@ 2019-08-03 21:02     ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2019-08-03 21:02 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Paul Eggert, emacs-devel

>> +	xsignal2 (Qerror,
>> +		  build_string ("replace-match subexpression does not exist"),
>> +		  subexp);
>
> This is probably a better error to signal here for this error, but it
> possibly changes the behaviour.  If somebody previously had
> condition-case'd this for args-out-of-range, then they'll get a new
> error signalled now (which is why I kept that signal)...

One way out is to `define-error` a new error for that, which has
`args-out-of-range` as a parent.


        Stefan




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-03 21:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190803200033.5628.11021@vcs0.savannah.gnu.org>
     [not found] ` <20190803200034.9E5F1209B1@vcs0.savannah.gnu.org>
2019-08-03 20:07   ` master 13fe8a2: Fix rare undefined behaviors in replace-match Lars Ingebrigtsen
2019-08-03 20:30     ` Paul Eggert
2019-08-03 21:02     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).