elisp - emacs: get lexically bound variable value by name -


this question has answer here:

the following not work void variable error. should eval replaced work?

;; -*- lexical-binding: t -*- (defun foo2 ()   (let ((b 'lkj))     (lambda ()       (eval 'b t))))  (funcall (foo2)) 

symbol-value doesn't work either (as documented).

looking variable's value name fundamentally incompatible proper lexical scoping, because proper lexical scoping admits alpha-renaming, i.e. (consistently) renaming variable should not affect result.

of course, if must know, can hack things around in cases, doing things like:

(funcall `(closure ,(nth 1 <someclosure>) () <exp>)) 

which might evaluate <exp> in same scope 1 <someclosure> comes. won't work if <someclosure> byte-compiled (or if made mistake).


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -