Subject: bug#748: closed (Re: bug#748: Elisp: lexical-let and cyclic structures)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 09 Jul 2011 17:52:02 +0000

Your bug report

#748: Elisp: lexical-let and cyclic structures

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
748: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=748
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#748: Elisp: lexical-let and cyclic structures
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Sat, 09 Jul 2011 13:51:43 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

I don't see a need to keep open this particular report, which was marked
"wontfix" some time ago.

Stefan Monnier wrote:

> Most programming languages do not accept infinite programs.  Elisp is
> no exception.  The fact that you can build cyclic abstract syntax trees
> and that they sometimes get evaluated correctly is just an accident.
>
> I.e. if it hurts, don't do it.

>From [email-masked] Wed Aug 20 06:56:19 2008
From: Michael Heerdegen <[email-masked]>
To: [email-masked]
Subject: Elisp: lexical-let and cyclic structures
Reply-to: [email-masked]
Date: Wed, 20 Aug 2008 15:57:16 +0200
Sender: [email-masked]

When using the reader constructs `#N=' and `#N#' for cyclic
structures, lexical-let sometimes produces errors which don't occur
with let.

Example: Eval the following:

(defun f (start)
  (lexical-let (start start)         ;; return a closure
    #1=(lambda (x) (if (= x start) x
		     (+ x (#1# (1- x)))))))

Then evaluating f ends with an error:

   (f 3)

    "Variable binding depth exceeds max-specpdl-size"

The problem also occurs without lambdas. Examples:

   (let         () '#1=(#1#))               ;; ==> (#0)
   (lexical-let () '#1=(#1#))               ;;  Error
   (let ((x '#1=(#1#))) (lexical-let () x)) ;; ==> (#0)
   `#1=(#1#)                                ;;  Error