[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19208: replace-match unhelpful error message
From: |
Lars Ingebrigtsen |
Subject: |
bug#19208: replace-match unhelpful error message |
Date: |
Sat, 03 Aug 2019 22:31:17 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Paul Eggert <eggert@cs.ucla.edu> writes:
>> No, that's just another sanity check -- num_regs is the max allowed
>> number of sub-matches. (I've now added some comments to clarify.)
>
> Unfortunately that patch messes up the sanity check, as the patched
> code allows 'sub' to be negative, or to be equal to
> search_regs.num_regs, and in either case this results in a bad
> pointer.
Sorry; thanks for fixing.
>> Yoda conditionals and a !...
>
> Actually those were Leibniz conditionals, which are comparisons
> involving "<" or "<=". The idea is that the conditionals' textual
> order reflects numeric order. This is a common style in math when
> doing range checking, e.g., "0 <= i < n". Yoda conditionals are
> expressions like "0 != x" which I agree are confusing.
Well, I think both are called Yoda conditionals, and they are
demonstrably confusing for people not used to seeing conditionals
written that way, which is I think pretty much everybody, except four
people working on Emacs. :-)
In real life, nobody says "if 62 is less than your age, you're eligible
for Medicare". I think one should write code for legibility -- but
opinions on what's legible various, of course. Reading "if (62 < age)",
for me, requires mental gymnastics.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- bug#19208: replace-match unhelpful error message, Lars Ingebrigtsen, 2019/08/03
- bug#19208: replace-match unhelpful error message, Paul Eggert, 2019/08/03
- bug#19208: replace-match unhelpful error message,
Lars Ingebrigtsen <=
- bug#19208: replace-match unhelpful error message, Noam Postavsky, 2019/08/03
- bug#19208: replace-match unhelpful error message, Andreas Schwab, 2019/08/04
- bug#19208: replace-match unhelpful error message, Noam Postavsky, 2019/08/04
- bug#19208: replace-match unhelpful error message, Andreas Schwab, 2019/08/04
- bug#19208: replace-match unhelpful error message, Paul Eggert, 2019/08/04
- bug#19208: replace-match unhelpful error message, Andreas Schwab, 2019/08/04
- bug#19208: replace-match unhelpful error message, Richard Stallman, 2019/08/04
- bug#19208: replace-match unhelpful error message, Lars Ingebrigtsen, 2019/08/04