3 ms·
Q. definitional scoping in CL? A1. Use a quasiquote and comma instead of a quote, which embeds the value inline. Not the direct answer though. (let ((msg "He
by guicho271828 10y ago
Q. definitional scoping in CL?
A1. Use a quasiquote and comma instead of a quote, which embeds the value inline. Not the direct answer though.
(let ((msg "Hello"))
(eval `(print ,msg)))
A2. Declare the variable as a SPECIAL variable and give it a dynamic scope (rather than lexical). Lexical environment/scope and dynamic environment/scope (resp.) are independent.
(let ((msg "Hello"))
(declare (special msg))
(eval '(print msg)))
;; -> "Hello"
So, when people "points out" any language-level flaw in common lisp most probably s/he simply doesn't read the ANSI spec.