GNU bug report logs - #77278
29.4; eval bug with lexical environment

Previous Next

Package: emacs;

Reported by: Daniel Cerqueira <dan.freesoftware <at> lispclub.com>

Date: Wed, 26 Mar 2025 12:19:03 UTC

Severity: normal

Found in version 29.4

Full log


Message #8 received at 77278 <at> debbugs.gnu.org (full text, mbox):

From: Pip Cet <pipcet <at> protonmail.com>
To: Daniel Cerqueira <dan.freesoftware <at> lispclub.com>
Cc: 77278 <at> debbugs.gnu.org
Subject: Re: bug#77278: 29.4; eval bug with lexical environment
Date: Wed, 26 Mar 2025 12:38:47 +0000
"Daniel Cerqueira" <dan.freesoftware <at> lispclub.com> writes:

> Eval this expression:
> (eval '(cons (quote a) x) '((x b)))
>
> It returns (a b) , it should return (a . b) .

The LEXENV argument to eval is an alist.  So

(eval '(cons (quote a) x) '((x . b)))

is what you want, and that does evaluate to (a . b).

> Also, eval this expression:
> (eval '(atom x) '((x b)))
>
> It returns nil , it should return t .

Same thing.  '((x b)) is equivalent to '((x . (b))), binding (b) to x,
so x is a list, not an atom.

> Since eval is the most important part of a LISP environment, it is good
> pratice to create a unit test to test eval, so that bugs in eval are
> easier to spot.

There are a few, it seems, in eval-tests.el.  However, if you'd like to
suggest more, that would be a good thing.

Pip





This bug report was last modified 80 days ago.

Previous Next


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