🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99435

byte compile fails on nested lambda functions

#99435
From: Sebastian Kremer
Date: Fri, 07 Sep 1990 13:38
42 lines
2114 bytes
;; This a perfectly valid, if somewhat unusual lisp function,
;; simplified from actual code I wrote:

(defun foo (fn-list)			; type M-C-x here
  (mapcar				; to define foo 
   (function				
    (lambda (FROM)
      ((lambda (FROM-1 TO) (list FROM-1 TO 0))
       (concat "/" FROM)	; FROM-1
       (concat "/tmp/" (file-name-nondirectory FROM)) ; TO
       )))
   fn-list))

(foo '("a" "b"))

;; Type C-x C-e at the beginning of this line to validate that foo
;; executes without errors, producing
;; (("/a" "/tmp/a" 0) ("/b" "/tmp/b" 0))

(byte-compile 'foo)

;; Type C-x C-e at the beginning of this line to get this error:
;; (wrong-type-argument symbolp (lambda (FROM-1 TO) (list FROM-1 TO 0)))

;; If you first load the uncompiled version of "bytecomp.el",
;; the backtrace is more readable:

;;get((lambda (FROM-1 TO) (list FROM-1 TO 0)) byte-compile)
;;  (let ...)
;;  (cond ...)
;;  byte-compile-form(((lambda (FROM-1 TO) (list FROM-1 TO 0))
;;		     (concat default-directory FROM)
;;		     (concat "/" (file-name-nondirectory FROM))))   

;; Thus byte-compile-form bombs on nested lambda functions.  It should
;; probably call itself recursively for nested lambdas.
;; The problem vanishes if you use quote instead of function to quote the
;; nested lambda function, because then it will not be byte-compiled at all.
--

Sebastian Kremer <sk@thp.Uni-Koeln.DE>
Institute of Theoretical Physics, University of Cologne, F. R. of Germany
Technical Details
Message-ID: <SK.90Sep7143805@sparc0.thp.uni-koeln.de>
Path: arc1-ca.pugleaf.net!gmdzi!unido!uni-koeln!uvax!sk

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,8990eaef15efce7b,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-09-07 15:51:43 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!uni-koeln!uvax!sk
From: sk@thp.uni-koeln.de (Sebastian Kremer)
Newsgroups: gnu.emacs.bug
Subject: byte compile fails on nested lambda functions
Message-ID: <SK.90Sep7143805@sparc0.thp.uni-koeln.de>
Date: 7 Sep 90 13:38:05 GMT
Sender: news@rrz.uni-koeln.de (USENET News System)
Distribution: gnu
Organization: Institute of Theoretical Physics, University of Cologne, F. R.
 Germany
Lines: 42
Posted: Fri Sep  7 14:38:05 1990