byte-compiling within lexical-let

Didier Verna didier at xemacs.org
Fri Jun 10 06:52:01 EDT 2011


  Hello,

byte-compiling an upward funarg situation within a lexical-let is
problematic:

(funcall (lexical-let ((a 42)) (lambda () a))) => 42


(funcall (lexical-let ((a 42)) (byte-compile (lambda () a)))) => 42

Okay, modulo a compile-log warning:
  ** Passing a quoted lambda (arg 1) to #'apply, forcing function quoting


After that, there are more contrived situations where it completely
stops working, as in cases where you need to partially evaluate the
lambda-form:

(funcall (lexical-let ((a 42)) (byte-compile (eval '(lambda () a)))))
=> [bad lexical ref]

This is simplified, but think `(lambda () ,foo stuff a).


In general, the problem occurs when you can't control the time at which
cl-macroexpand-all performs. In such situations, the lexically let
symbols translation may miss some cases occuring in already
byte-compiled forms.

I can't quite figure out a way around this right now. Any ideas ?

-- 
Resistance is futile. You will be jazzimilated.

Scientific site:   http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com



More information about the XEmacs-Beta mailing list