* member inconsistency?
@ 2016-01-28 8:42 Nicolas Goaziou
2016-01-28 9:41 ` Philipp Stephani
0 siblings, 1 reply; 20+ messages in thread
From: Nicolas Goaziou @ 2016-01-28 8:42 UTC (permalink / raw)
To: emacs-devel
Hello,
The following behaviour is surprising
(assq 'a 'b) => #ERROR
(memq 'a 'b) => #ERROR
(assoc 'a 'b) => #ERROR
so far so good, but
(member 'a 'b) => nil
I was caught by this when replacing (member SYMBOL ...) with (memq
SYMBOL ...). Is it intentional? Should I file a bug report instead?
Regards,
--
Nicolas Goaziou 0x80A93738
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 8:42 member inconsistency? Nicolas Goaziou
@ 2016-01-28 9:41 ` Philipp Stephani
2016-01-28 10:14 ` Andreas Schwab
0 siblings, 1 reply; 20+ messages in thread
From: Philipp Stephani @ 2016-01-28 9:41 UTC (permalink / raw)
To: Nicolas Goaziou, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 647 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> schrieb am Do., 28. Jan. 2016 um
09:41 Uhr:
> Hello,
>
> The following behaviour is surprising
>
> (assq 'a 'b) => #ERROR
> (memq 'a 'b) => #ERROR
> (assoc 'a 'b) => #ERROR
>
For completeness, memql and assq have the same behavior.
>
> so far so good, but
>
> (member 'a 'b) => nil
>
> I was caught by this when replacing (member SYMBOL ...) with (memq
> SYMBOL ...). Is it intentional? Should I file a bug report instead?
>
Yes, I think this is a bug. There is no reason why `member' should be so
inconsistent, especially given that is has (almost) the same docstring as
memq and memql.
[-- Attachment #2: Type: text/html, Size: 1172 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 9:41 ` Philipp Stephani
@ 2016-01-28 10:14 ` Andreas Schwab
2016-01-28 10:25 ` Stephen Berman
0 siblings, 1 reply; 20+ messages in thread
From: Andreas Schwab @ 2016-01-28 10:14 UTC (permalink / raw)
To: Philipp Stephani; +Cc: Nicolas Goaziou, emacs-devel
Philipp Stephani <p.stephani2@gmail.com> writes:
> Nicolas Goaziou <mail@nicolasgoaziou.fr> schrieb am Do., 28. Jan. 2016 um
> 09:41 Uhr:
>
>> Hello,
>>
>> The following behaviour is surprising
>>
>> (assq 'a 'b) => #ERROR
>> (memq 'a 'b) => #ERROR
>> (assoc 'a 'b) => #ERROR
>>
>
> For completeness, memql and assq have the same behavior.
memql works like member if looking for a float, like memq otherwise.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 10:14 ` Andreas Schwab
@ 2016-01-28 10:25 ` Stephen Berman
2016-01-28 15:48 ` Eli Zaretskii
2016-01-28 23:38 ` Johan Bockgård
0 siblings, 2 replies; 20+ messages in thread
From: Stephen Berman @ 2016-01-28 10:25 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Philipp Stephani, Nicolas Goaziou, emacs-devel
On Thu, 28 Jan 2016 11:14:37 +0100 Andreas Schwab <schwab@suse.de> wrote:
> Philipp Stephani <p.stephani2@gmail.com> writes:
>
>> Nicolas Goaziou <mail@nicolasgoaziou.fr> schrieb am Do., 28. Jan. 2016 um
>> 09:41 Uhr:
>>
>>> Hello,
>>>
>>> The following behaviour is surprising
>>>
>>> (assq 'a 'b) => #ERROR
>>> (memq 'a 'b) => #ERROR
>>> (assoc 'a 'b) => #ERROR
>>>
>>
>> For completeness, memql and assq have the same behavior.
>
> memql works like member if looking for a float, like memq otherwise.
The definition of `memq' calls CHECK_LIST (list) and `assq' and `assoc'
return CAR (list), and each of these signals the error in case of a
wrong type. In contrast, `member' (and `memql' in the float case) has
no check and also uses a for-loop with the condition CONSP (tail), and
when this fails, the function just returns Qnil. Adding CHECK_LIST
(list) before the for-loop makes (member 'a 'b) signal an error.
(Instead of a for-loop, the other three use while (1), so the loop
always runs and the type checks get executed.)
Steve Berman
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 10:25 ` Stephen Berman
@ 2016-01-28 15:48 ` Eli Zaretskii
2016-01-28 17:30 ` Stephen Berman
2016-01-28 23:38 ` Johan Bockgård
1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2016-01-28 15:48 UTC (permalink / raw)
To: Stephen Berman; +Cc: schwab, p.stephani2, mail, emacs-devel
> From: Stephen Berman <stephen.berman@gmx.net>
> Date: Thu, 28 Jan 2016 11:25:33 +0100
> Cc: Philipp Stephani <p.stephani2@gmail.com>,
> Nicolas Goaziou <mail@nicolasgoaziou.fr>, emacs-devel@gnu.org
>
> In contrast, `member' (and `memql' in the float case) has no check
> and also uses a for-loop with the condition CONSP (tail), and when
> this fails, the function just returns Qnil. Adding CHECK_LIST
> (list) before the for-loop makes (member 'a 'b) signal an error.
I'd say CHECK_LIST_CONS, not CHECK_LIST, don't you agree?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 15:48 ` Eli Zaretskii
@ 2016-01-28 17:30 ` Stephen Berman
2016-01-28 18:35 ` Eli Zaretskii
2016-01-28 22:18 ` Andreas Schwab
0 siblings, 2 replies; 20+ messages in thread
From: Stephen Berman @ 2016-01-28 17:30 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: schwab, p.stephani2, mail, emacs-devel
On Thu, 28 Jan 2016 17:48:29 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Stephen Berman <stephen.berman@gmx.net>
>> Date: Thu, 28 Jan 2016 11:25:33 +0100
>> Cc: Philipp Stephani <p.stephani2@gmail.com>,
>> Nicolas Goaziou <mail@nicolasgoaziou.fr>, emacs-devel@gnu.org
>>
>> In contrast, `member' (and `memql' in the float case) has no check
>> and also uses a for-loop with the condition CONSP (tail), and when
>> this fails, the function just returns Qnil. Adding CHECK_LIST
>> (list) before the for-loop makes (member 'a 'b) signal an error.
>
> I'd say CHECK_LIST_CONS, not CHECK_LIST, don't you agree?
To be honest, I overlooked that CHECK_LIST_CONS is inside the for-loop.
But it seems a bit ugly to have the same check before the loop and
inside it as well. How about the following:
diff --git a/src/fns.c b/src/fns.c
index 86ad333..17c4a75 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1349,7 +1349,7 @@ The value is actually the tail of LIST whose car is ELT. */)
(register Lisp_Object elt, Lisp_Object list)
{
register Lisp_Object tail;
- for (tail = list; CONSP (tail); tail = XCDR (tail))
+ for (tail = list; CONSP (tail) || !NILP (tail); tail = XCDR (tail))
{
register Lisp_Object tem;
CHECK_LIST_CONS (tail, list);
Or is having the check before the loop better it catches the error sooner?
Steve Berman
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 17:30 ` Stephen Berman
@ 2016-01-28 18:35 ` Eli Zaretskii
2016-01-28 21:57 ` Stephen Berman
2016-01-28 22:18 ` Andreas Schwab
1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2016-01-28 18:35 UTC (permalink / raw)
To: Stephen Berman; +Cc: schwab, p.stephani2, mail, emacs-devel
> From: Stephen Berman <stephen.berman@gmx.net>
> Cc: schwab@suse.de, p.stephani2@gmail.com, mail@nicolasgoaziou.fr, emacs-devel@gnu.org
> Date: Thu, 28 Jan 2016 18:30:04 +0100
>
> diff --git a/src/fns.c b/src/fns.c
> index 86ad333..17c4a75 100644
> --- a/src/fns.c
> +++ b/src/fns.c
> @@ -1349,7 +1349,7 @@ The value is actually the tail of LIST whose car is ELT. */)
> (register Lisp_Object elt, Lisp_Object list)
> {
> register Lisp_Object tail;
> - for (tail = list; CONSP (tail); tail = XCDR (tail))
> + for (tail = list; CONSP (tail) || !NILP (tail); tail = XCDR (tail))
> {
> register Lisp_Object tem;
> CHECK_LIST_CONS (tail, list);
>
> Or is having the check before the loop better it catches the error sooner?
Before the loop sounds slightly less obscure to me.
Thanks.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 18:35 ` Eli Zaretskii
@ 2016-01-28 21:57 ` Stephen Berman
0 siblings, 0 replies; 20+ messages in thread
From: Stephen Berman @ 2016-01-28 21:57 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: schwab, p.stephani2, mail, emacs-devel
On Thu, 28 Jan 2016 20:35:40 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Stephen Berman <stephen.berman@gmx.net>
>> Cc: schwab@suse.de, p.stephani2@gmail.com, mail@nicolasgoaziou.fr, emacs-devel@gnu.org
>> Date: Thu, 28 Jan 2016 18:30:04 +0100
>>
>> diff --git a/src/fns.c b/src/fns.c
>> index 86ad333..17c4a75 100644
>> --- a/src/fns.c
>> +++ b/src/fns.c
>> @@ -1349,7 +1349,7 @@ The value is actually the tail of LIST whose car is ELT. */)
>> (register Lisp_Object elt, Lisp_Object list)
>> {
>> register Lisp_Object tail;
>> - for (tail = list; CONSP (tail); tail = XCDR (tail))
>> + for (tail = list; CONSP (tail) || !NILP (tail); tail = XCDR (tail))
>> {
>> register Lisp_Object tem;
>> CHECK_LIST_CONS (tail, list);
>>
>> Or is having the check before the loop better it catches the error sooner?
>
> Before the loop sounds slightly less obscure to me.
With just
CHECK_LIST_CONS (list, list);
before the loop, the build fails with "wrong-type-argument: nil, listp"
in subr.el. With
if (!NILP (list))
CHECK_LIST_CONS (list, list);
before the loop, the build succeeds (same with Fmemql). But isn't this
then effectively the same thing as having CHECK_LIST (list) before the
loop? With that, the build also succeeds and I didn't see any problems
with calls to member. I'm confused.
Two other things I don't get: (1) I wondered why Fmember can't be
defined with a while (1) loop analogously to Fmemq, Fassq und Fassoc,
but when I tried that the build failed at
temacs --batch --load loadup bootstrap
even though I added a !NILP (list) check.
(2) Why are there three occurrences in a row of these lines in Fmemq
(and similar repetitions in Fassq and Fassoc)?
if (!CONSP (list) || EQ (XCAR (list), elt))
break;
list = XCDR (list);
I commented out two of the occurrences and built emacs successfully and
all my tests of memq went as expected. So why the repetitions?
Steve Berman
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 17:30 ` Stephen Berman
2016-01-28 18:35 ` Eli Zaretskii
@ 2016-01-28 22:18 ` Andreas Schwab
2016-01-28 22:41 ` Stephen Berman
1 sibling, 1 reply; 20+ messages in thread
From: Andreas Schwab @ 2016-01-28 22:18 UTC (permalink / raw)
To: Stephen Berman; +Cc: Eli Zaretskii, p.stephani2, mail, emacs-devel
Stephen Berman <stephen.berman@gmx.net> writes:
> diff --git a/src/fns.c b/src/fns.c
> index 86ad333..17c4a75 100644
> --- a/src/fns.c
> +++ b/src/fns.c
> @@ -1349,7 +1349,7 @@ The value is actually the tail of LIST whose car is ELT. */)
> (register Lisp_Object elt, Lisp_Object list)
> {
> register Lisp_Object tail;
> - for (tail = list; CONSP (tail); tail = XCDR (tail))
> + for (tail = list; CONSP (tail) || !NILP (tail); tail = XCDR (tail))
> {
> register Lisp_Object tem;
> CHECK_LIST_CONS (tail, list);
The check for CONSP in the loop condition is redundant, that is already
checked by CHECK_LIST_CONS (and the latter was a no-op before).
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 22:18 ` Andreas Schwab
@ 2016-01-28 22:41 ` Stephen Berman
0 siblings, 0 replies; 20+ messages in thread
From: Stephen Berman @ 2016-01-28 22:41 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Eli Zaretskii, p.stephani2, mail, emacs-devel
On Thu, 28 Jan 2016 23:18:29 +0100 Andreas Schwab <schwab@suse.de> wrote:
> Stephen Berman <stephen.berman@gmx.net> writes:
>
>> diff --git a/src/fns.c b/src/fns.c
>> index 86ad333..17c4a75 100644
>> --- a/src/fns.c
>> +++ b/src/fns.c
>> @@ -1349,7 +1349,7 @@ The value is actually the tail of LIST whose car is ELT. */)
>> (register Lisp_Object elt, Lisp_Object list)
>> {
>> register Lisp_Object tail;
>> - for (tail = list; CONSP (tail); tail = XCDR (tail))
>> + for (tail = list; CONSP (tail) || !NILP (tail); tail = XCDR (tail))
>> {
>> register Lisp_Object tem;
>> CHECK_LIST_CONS (tail, list);
>
> The check for CONSP in the loop condition is redundant, that is already
> checked by CHECK_LIST_CONS (and the latter was a no-op before).
Thanks. So is the following patch ok to commit to emacs-25?
diff --git a/src/fns.c b/src/fns.c
index 86ad333..b75f0c8 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1349,7 +1349,7 @@ The value is actually the tail of LIST whose car is ELT. */)
(register Lisp_Object elt, Lisp_Object list)
{
register Lisp_Object tail;
- for (tail = list; CONSP (tail); tail = XCDR (tail))
+ for (tail = list; !NILP (tail); tail = XCDR (tail))
{
register Lisp_Object tem;
CHECK_LIST_CONS (tail, list);
@@ -1397,7 +1397,7 @@ The value is actually the tail of LIST whose car is ELT. */)
if (!FLOATP (elt))
return Fmemq (elt, list);
- for (tail = list; CONSP (tail); tail = XCDR (tail))
+ for (tail = list; !NILP (tail); tail = XCDR (tail))
{
register Lisp_Object tem;
CHECK_LIST_CONS (tail, list);
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 10:25 ` Stephen Berman
2016-01-28 15:48 ` Eli Zaretskii
@ 2016-01-28 23:38 ` Johan Bockgård
2016-01-28 23:57 ` Stephen Berman
2016-01-29 23:58 ` Richard Stallman
1 sibling, 2 replies; 20+ messages in thread
From: Johan Bockgård @ 2016-01-28 23:38 UTC (permalink / raw)
To: Stephen Berman
Cc: Andreas Schwab, Philipp Stephani, Nicolas Goaziou, emacs-devel
Stephen Berman <stephen.berman@gmx.net> writes:
> In contrast, `member' (and `memql' in the float case) has no check and
> also uses a for-loop with the condition CONSP (tail), and when this
> fails, the function just returns Qnil.
`delete' and `delq' also has the bug.
http://debbugs.gnu.org/264
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 23:38 ` Johan Bockgård
@ 2016-01-28 23:57 ` Stephen Berman
2016-01-29 10:25 ` Andreas Schwab
2016-01-29 23:58 ` Richard Stallman
1 sibling, 1 reply; 20+ messages in thread
From: Stephen Berman @ 2016-01-28 23:57 UTC (permalink / raw)
To: Johan Bockgård
Cc: Andreas Schwab, Philipp Stephani, Nicolas Goaziou, emacs-devel
On Fri, 29 Jan 2016 00:38:24 +0100 Johan Bockgård <bojohan@gnu.org> wrote:
> Stephen Berman <stephen.berman@gmx.net> writes:
>
>> In contrast, `member' (and `memql' in the float case) has no check and
>> also uses a for-loop with the condition CONSP (tail), and when this
>> fails, the function just returns Qnil.
>
> `delete' and `delq' also has the bug.
>
> http://debbugs.gnu.org/264
Oh, thanks for the pointer. So the patch I proposed reverts a change
Stefan deliberately made more than eight years ago. That's not
something I feel entitled to do.
Steve Berman
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 23:57 ` Stephen Berman
@ 2016-01-29 10:25 ` Andreas Schwab
2016-01-29 11:20 ` Stephen Berman
2016-01-29 14:15 ` Eli Zaretskii
0 siblings, 2 replies; 20+ messages in thread
From: Andreas Schwab @ 2016-01-29 10:25 UTC (permalink / raw)
To: Stephen Berman
Cc: Philipp Stephani, Nicolas Goaziou, Johan Bockgård,
emacs-devel
Stephen Berman <stephen.berman@gmx.net> writes:
> Oh, thanks for the pointer. So the patch I proposed reverts a change
> Stefan deliberately made more than eight years ago.
IMHO that change was wrong. It made CHECK_LIST_CONS a no-op, and there
was nothing wrong with it before Stefan's change.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-29 10:25 ` Andreas Schwab
@ 2016-01-29 11:20 ` Stephen Berman
2016-01-29 14:15 ` Eli Zaretskii
1 sibling, 0 replies; 20+ messages in thread
From: Stephen Berman @ 2016-01-29 11:20 UTC (permalink / raw)
To: Andreas Schwab
Cc: Philipp Stephani, Nicolas Goaziou, Johan Bockgård,
emacs-devel
On Fri, 29 Jan 2016 11:25:42 +0100 Andreas Schwab <schwab@suse.de> wrote:
> Stephen Berman <stephen.berman@gmx.net> writes:
>
>> Oh, thanks for the pointer. So the patch I proposed reverts a change
>> Stefan deliberately made more than eight years ago.
>
> IMHO that change was wrong. It made CHECK_LIST_CONS a no-op, and there
> was nothing wrong with it before Stefan's change.
AFAIU the code, I agree with you, but Stefan evidently didn't see it
that way at the time, and while the ChangeLog doesn't indicate whether a
problem was being fixed (and I found no discussion about it by skimming
through the emacs-devel archive), he disputed there was a bug when Johan
Bockgård reported exactly this issue a few months after the change. But
I don't feel competent enough to argue against it, so I'm bowing out here.
Steve Berman
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-29 10:25 ` Andreas Schwab
2016-01-29 11:20 ` Stephen Berman
@ 2016-01-29 14:15 ` Eli Zaretskii
2016-01-29 19:17 ` John Wiegley
1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2016-01-29 14:15 UTC (permalink / raw)
To: Andreas Schwab; +Cc: p.stephani2, stephen.berman, bojohan, mail, emacs-devel
> From: Andreas Schwab <schwab@suse.de>
> Date: Fri, 29 Jan 2016 11:25:42 +0100
> Cc: Philipp Stephani <p.stephani2@gmail.com>,
> Nicolas Goaziou <mail@nicolasgoaziou.fr>,
> Johan Bockgård <bojohan@gnu.org>, emacs-devel@gnu.org
>
> Stephen Berman <stephen.berman@gmx.net> writes:
>
> > Oh, thanks for the pointer. So the patch I proposed reverts a change
> > Stefan deliberately made more than eight years ago.
>
> IMHO that change was wrong. It made CHECK_LIST_CONS a no-op, and there
> was nothing wrong with it before Stefan's change.
But given that we've lived with it for more than 8 years, the revert
should have been done on master, not the release branch, IMO.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-29 14:15 ` Eli Zaretskii
@ 2016-01-29 19:17 ` John Wiegley
0 siblings, 0 replies; 20+ messages in thread
From: John Wiegley @ 2016-01-29 19:17 UTC (permalink / raw)
To: Eli Zaretskii
Cc: Andreas Schwab, bojohan, emacs-devel, p.stephani2, mail,
stephen.berman
>>>>> Eli Zaretskii <eliz@gnu.org> writes:
>> > Oh, thanks for the pointer. So the patch I proposed reverts a change
>> > Stefan deliberately made more than eight years ago.
>>
>> IMHO that change was wrong. It made CHECK_LIST_CONS a no-op, and there
>> was nothing wrong with it before Stefan's change.
> But given that we've lived with it for more than 8 years, the revert should
> have been done on master, not the release branch, IMO.
Agreed.
--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-28 23:38 ` Johan Bockgård
2016-01-28 23:57 ` Stephen Berman
@ 2016-01-29 23:58 ` Richard Stallman
2016-02-01 7:10 ` Fabrice Popineau
1 sibling, 1 reply; 20+ messages in thread
From: Richard Stallman @ 2016-01-29 23:58 UTC (permalink / raw)
To: Johan Bockgård
Cc: schwab, p.stephani2, stephen.berman, mail, emacs-devel
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> > In contrast, `member' (and `memql' in the float case) has no check and
> > also uses a for-loop with the condition CONSP (tail), and when this
> > fails, the function just returns Qnil.
> `delete' and `delq' also has the bug.
Why consider it a bug? What is wrong with it?
--
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-01-29 23:58 ` Richard Stallman
@ 2016-02-01 7:10 ` Fabrice Popineau
2016-02-01 11:04 ` Richard Stallman
0 siblings, 1 reply; 20+ messages in thread
From: Fabrice Popineau @ 2016-02-01 7:10 UTC (permalink / raw)
To: emacs-devel
Richard Stallman <rms <at> gnu.org> writes:
>
> [[[ To any NSA and FBI agents reading my email: please consider ]]]
> [[[ whether defending the US Constitution against all enemies, ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
> > > In contrast, `member' (and `memql' in the float case) has no check
and
> > > also uses a for-loop with the condition CONSP (tail), and when
this
> > > fails, the function just returns Qnil.
>
> > `delete' and `delq' also has the bug.
>
> Why consider it a bug? What is wrong with it?
>
It makes it harder to catch the bug if you
inadvertently call member with its second
argument not being a sequence ?
Fabrice
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-02-01 7:10 ` Fabrice Popineau
@ 2016-02-01 11:04 ` Richard Stallman
2016-02-01 12:20 ` Fabrice Popineau
0 siblings, 1 reply; 20+ messages in thread
From: Richard Stallman @ 2016-02-01 11:04 UTC (permalink / raw)
To: Fabrice Popineau; +Cc: emacs-devel
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> It makes it harder to catch the bug if you
> inadvertently call member with its second
> argument not being a sequence ?
There are two ways to look at this:
* Lists should end in nil, and if they don't, functions should complain.
* It is useful generality if functions accept lists that end
in some other atom.
I don't see that the first is obviously preferable.
--
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: member inconsistency?
2016-02-01 11:04 ` Richard Stallman
@ 2016-02-01 12:20 ` Fabrice Popineau
0 siblings, 0 replies; 20+ messages in thread
From: Fabrice Popineau @ 2016-02-01 12:20 UTC (permalink / raw)
To: rms; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 853 bytes --]
2016-02-01 12:04 GMT+01:00 Richard Stallman <rms@gnu.org>:
> [[[ To any NSA and FBI agents reading my email: please consider ]]]
> [[[ whether defending the US Constitution against all enemies, ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
> > It makes it harder to catch the bug if you
> > inadvertently call member with its second
> > argument not being a sequence ?
>
> There are two ways to look at this:
>
> * Lists should end in nil, and if they don't, functions should complain.
>
> * It is useful generality if functions accept lists that end
> in some other atom.
>
> I don't see that the first is obviously preferable.
>
>
I'm biased by CL I guess.
Then you need 2 functions, one for proper lists and one for improper lists.
But I would call the second one `tree-member' :-)
Greetings,
Fabrice
[-- Attachment #2: Type: text/html, Size: 1368 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2016-02-01 12:20 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-28 8:42 member inconsistency? Nicolas Goaziou
2016-01-28 9:41 ` Philipp Stephani
2016-01-28 10:14 ` Andreas Schwab
2016-01-28 10:25 ` Stephen Berman
2016-01-28 15:48 ` Eli Zaretskii
2016-01-28 17:30 ` Stephen Berman
2016-01-28 18:35 ` Eli Zaretskii
2016-01-28 21:57 ` Stephen Berman
2016-01-28 22:18 ` Andreas Schwab
2016-01-28 22:41 ` Stephen Berman
2016-01-28 23:38 ` Johan Bockgård
2016-01-28 23:57 ` Stephen Berman
2016-01-29 10:25 ` Andreas Schwab
2016-01-29 11:20 ` Stephen Berman
2016-01-29 14:15 ` Eli Zaretskii
2016-01-29 19:17 ` John Wiegley
2016-01-29 23:58 ` Richard Stallman
2016-02-01 7:10 ` Fabrice Popineau
2016-02-01 11:04 ` Richard Stallman
2016-02-01 12:20 ` Fabrice Popineau
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.