3 ms·
In a Lisp 1 function and variables share the same namespace. (defvar foo 5) ; variable with the name foo (defun foo () 5) ; function with the name fo
by thibran 8y ago
In a Lisp 1 function and variables share the same namespace.
(defvar foo 5) ; variable with the name foo
(defun foo () 5) ; function with the name foo
In a Lisp 1 the defun would overwrite the previous variable declaration. In a Lisp 2 though, both expressions coexist.
- KayEss 8y agoAh, that's really interesting. This one only has a single namespace, but the one I simplified it from actually has two. I guess that makes that one a Lisp 2 :-)
- sedachv 8y agoLast week I came across a Usenet post from Kent Pitman (who helped create Common Lisp, and coined the terms Lisp1 and Lisp2 in this paper: https://www.dreamsongs.com/Separation.html https://www.dreamsongs.com/Separation.html) which provides the best explanation I have seen on why Lisp2 is a good idea: https://groups.google.com/forum/#!msg/comp.lang.lisp/6TkfPLeWpk0/rAxTREHhlw0J https://groups.google.com/forum/#!msg/comp.lang.lisp/6TkfPLe... Also as pointed out by KMP later in that thread, block and go tags are separate namespaces, and so are type names. I like to say that it is really Lisp1 vs LispN. Any language with macros and first-class identifiers is going to be capable of having arbitrarily many namespaces.