GNU bug report logs - #31718
26.1; Strange behavior of `cond'

Previous Next

Package: emacs;

Reported by: Ikumi Keita <ikumi <at> ikumi.que.jp>

Date: Tue, 5 Jun 2018 06:27:02 UTC

Severity: normal

Tags: patch

Merged with 28806, 31734

Found in version 26.1

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Robert Cochran <robert-emacs <at> cochranmail.com>
Cc: Andreas Schwab <schwab <at> suse.de>, 31718 <at> debbugs.gnu.org, Vibhav Pant <vibhavp <at> gmail.com>
Subject: bug#31718: 26.1; Strange behavior of `cond'
Date: Wed, 06 Jun 2018 18:14:03 +0900
Hi Robert,

>>>>> Robert Cochran <robert-emacs <at> cochranmail.com> writes:
> Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
>> Hi Andreas, thanks for your reply.
>> 
>>>>>>> Andreas Schwab <schwab <at> suse.de> writes:
>>> On Jun 05 2018, Ikumi Keita <ikumi <at> ikumi.que.jp> wrote:
>>>> (defun xyz (arg)
>>>> "dummy"
>>>> ;    (cond ((eq arg nil) ; OK
>>>> ;    (cond ((eq arg 'abc) ; OK
>>>> ;    (cond ((eq arg 'def) ; OK
>>>> (cond ((eq arg 'default) ; NG
>> 
>>> The byte-compiler uses 'default as a magic symbol, which breaks this
>>> case.
>> 
>> Does this mean that this behavior is a (new) designed feature of elisp
>> and not a bug?
>> If so, is it the respoisibility of the authors of the codes to rewrite
>> not to use `default' or else to make sure to set
>> `byte-compile-cond-use-jump-table' to nil at byte compile?

> I for one consider this a bug, for 2 reasons:

> 1) It's not reasonable to expect a Lisp programmer to just know that
> using the symbol default is problematic.

> 2) It creates diverging behavior between compiled and non-compiled Lisp.

I agree.

> To that end, I've made a small patch to rectify the behavior. Instead of
> hardcoding a symbol, it uses gensym to create a unique one. I did a full
> build of Emacs, as well as ran 'make check' and had identical results
> pre- and post-change, so I'm reasonably sure it's correct.

Thanks for the patch, it fixes the problem on my side!

Regards,
Ikumi Keita




This bug report was last modified 6 years and 342 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.