Anybody know that game where you write a program that can print itself? Are there games where a program interprets code from another language so well it can interpret an interpreter that can interpret its code? (interpreterA is written in langA, it can run interpreterB written in langB, which is able to run enough of langA to run interpreterA)
> Nevertheless, this defect is largely harmless because Common Lisp separates the name space into one for functions and one for variables. In other words, it can be said that the existence of this defect has been justified the separation of name spaces which has made the semantics of the Common Lisp language complex unnecessarily
One note on variable capture in Common Lisp; while it is true that a lisp-2 runs into the issues somewhat less often than a lisp-1, the existence of FLET and LABELS should let people know that it doesn't solve the problem.
The real solution to this in Common Lisp is packages.
(in-package foo)
(defun bar () (do-something))
(defmacro baz (x) `(bar ,x))
(in-package quux)
(flet ((bar () (do-something-else)))
(baz 2)) ; calls foo::bar not the bar bound in above FLET
Also, many people like that Common Lisp has two namespaces because there are many identifiers that are useful as both nouns and verbs (e.g. LIST).
Thank you for your comment. However, a capture still occurs if a
local variable happens to have the same name as some function in the
standard library.
As for nouns and verbs, higher-order functions treat verbs
(i.e. functions) as values (i.e. nouns). From the viewpoint of
functional programming or lambda calculus, the distinction between
them is not necessarily natural.
Thanks for replying! It is true that there is capture w.r.t. the standard library, and the Common Lisp specification forbids rebinding those. This is a case where the separate namespace complicates the semantics.
10 comments
[ 3.2 ms ] story [ 35.1 ms ] threadIs there a benchmark suite that could compare various Lisp implementations? Would be interesting to see their overall comparison...
100 language cyclic quine relay.
One note on variable capture in Common Lisp; while it is true that a lisp-2 runs into the issues somewhat less often than a lisp-1, the existence of FLET and LABELS should let people know that it doesn't solve the problem.
The real solution to this in Common Lisp is packages.
Also, many people like that Common Lisp has two namespaces because there are many identifiers that are useful as both nouns and verbs (e.g. LIST).As for nouns and verbs, higher-order functions treat verbs (i.e. functions) as values (i.e. nouns). From the viewpoint of functional programming or lambda calculus, the distinction between them is not necessarily natural.