From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#748: Elisp: lexical-let and cyclic structures Date: Wed, 20 Aug 2008 21:12:22 -0400 Message-ID: References: <1219240636.0@debian> Reply-To: Stefan Monnier , 748@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1219282120 24754 80.91.229.12 (21 Aug 2008 01:28:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Aug 2008 01:28:40 +0000 (UTC) To: 748@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 21 03:29:32 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KVyzT-0007a5-Jv for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Aug 2008 03:29:31 +0200 Original-Received: from localhost ([127.0.0.1]:36783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVyyV-0003Sh-TY for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Aug 2008 21:28:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KVyxZ-000319-Jz for bug-gnu-emacs@gnu.org; Wed, 20 Aug 2008 21:27:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KVyxW-0002zs-Rb for bug-gnu-emacs@gnu.org; Wed, 20 Aug 2008 21:27:33 -0400 Original-Received: from [199.232.76.173] (port=43512 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVyxW-0002zl-HU for bug-gnu-emacs@gnu.org; Wed, 20 Aug 2008 21:27:30 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:54570) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KVyxV-0002Mz-VW for bug-gnu-emacs@gnu.org; Wed, 20 Aug 2008 21:27:30 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m7L1RR3e030411; Wed, 20 Aug 2008 18:27:27 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m7L1K3qT027621; Wed, 20 Aug 2008 18:20:03 -0700 X-Loop: don@donarmstrong.com Resent-From: Stefan Monnier Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 21 Aug 2008 01:20:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 748 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 748-submit@emacsbugs.donarmstrong.com id=B748.121928115625790 (code B ref 748); Thu, 21 Aug 2008 01:20:03 +0000 Original-Received: (at 748) by emacsbugs.donarmstrong.com; 21 Aug 2008 01:12:36 +0000 Original-Received: from smtp-04.arnet.com.ar (smtp-04.arnet.com.ar [200.45.191.26]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m7L1CTmC025778 for <748@emacsbugs.donarmstrong.com>; Wed, 20 Aug 2008 18:12:33 -0700 Original-Received: (qmail 11956 invoked from network); 21 Aug 2008 01:10:37 -0000 Original-Received: from unknown (HELO ceviche.home) (200.117.157.213) by 0 with SMTP; 21 Aug 2008 01:10:36 -0000 Original-Received: by ceviche.home (Postfix, from userid 20848) id E1851B404F; Wed, 20 Aug 2008 21:12:22 -0400 (EDT) In-Reply-To: <1219240636.0@debian> (Michael Heerdegen's message of "Wed, 20 Aug 2008 15:57:16 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-CrossAssassin-Score: 2 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Wed, 20 Aug 2008 21:27:33 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:19588 Archived-At: tag +748 wontfix thanks > When using the reader constructs `#N=' and `#N#' for cyclic > structures, lexical-let sometimes produces errors which don't occur > with let. 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. > (defun f (start) > (lexical-let (start start) ;; return a closure > #1=(lambda (x) (if (= x start) x > (+ x (#1# (1- x))))))) For this case, I'd recommend to make the recursion explicit, e.g.: (defun f (start) (lexical-let ((start start)) ;; return a closure (labels ((loop (x) (if (= x start) x (+ x (loop (1- x)))))) loop))) -- Stefan