Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Scope (computer science)
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Lisp === [[Lisp (programming language)|Lisp]] dialects have various rules for scope. The original Lisp used dynamic scope; it was [[Scheme (programming language)|Scheme]], inspired by [[ALGOL]], that introduced static (lexical) scope to the Lisp family. [[Maclisp]] used dynamic scope by default in the interpreter and lexical scope by default in compiled code, though compiled code could access dynamic bindings by use of <code>SPECIAL</code> declarations for particular variables.<ref>{{cite web |url=http://maclisp.info/pitmanual/complr.html#23.1.2 |title=The Revised Maclisp Manual (The Pitmanual), Sunday Morning Edition |last=Pitman |first=Kent |date=December 16, 2007 |website=MACLISP.info |publisher=HyperMeta Inc. |access-date=October 20, 2018|at=Declarations and the Compiler, Concept "Variables" |quote= If the variable to be bound has been declared to be special, the binding is compiled as code to imitate the way the interpreter binds variables }}</ref> However, [[Maclisp]] treated lexical binding more as an optimization than one would expect in modern languages, and it did not come with the [[Closure (computer programming)|closure]] feature one might expect of lexical scope in modern Lisps. A separate operation, <code>*FUNCTION</code>, was available to somewhat clumsily work around some of that issue.<ref>{{cite web |url=http://www.maclisp.info/pitmanual/eval.html#3.7.1 |title=The Revised Maclisp Manual (The Pitmanual), Sunday Morning Edition |last=Pitman |first=Kent |date=December 16, 2007 |website=MACLISP.info |publisher=HyperMeta Inc. |access-date=October 20, 2018|at=The Evaluator, Special Form <code>*FUNCTION</code> |quote= <code>*FUNCTION</code> is intended to help solve the "[[funarg problem]]," however it only works in some easy cases. }}</ref> [[Common Lisp]] adopted lexical scope from [[Scheme (programming language)|Scheme]],<ref>{{cite web |url=http://www.lispworks.com/documentation/lw50/CLHS/Body/01_ab.htm |title=Common Lisp HyperSpec |last=Pitman |first=Kent |collaboration=webbed version of ANSI standard X3.226-1994 |date=1996 |website=Lispworks.com |publisher=LispWorks Ltd. |access-date=October 20, 2018|at=1.1.2 History |quote=MacLisp improved on the Lisp 1.5 notion of special variables ... The primary influences on Common Lisp were Lisp Machine Lisp, MacLisp, NIL, S-1 Lisp, Spice Lisp, and Scheme. }}</ref> as did [[Clojure]]. [[ISLISP]] has lexical scope for ordinary variables. It also has dynamic variables, but they are in all cases explicitly marked; they must be defined by a <code>defdynamic</code> special form, bound by a <code>dynamic-let</code> special form, and accessed by an explicit <code>dynamic</code> special form.<ref>{{cite web |url=http://www.islisp.info/Documents/PDF/islisp-2007-03-17-pd-v23.pdf |title=Programming Language ISLISP, ISLISP Working Draft 23.0|website=ISLISP.info |access-date=October 20, 2018 |at=11.1 The lexical principle |quote= Dynamic bindings are established and accessed by a separate mechanism (i.e., <code>defdynamic</code>, <code>dynamic-let</code>, and <code>dynamic</code>).}}</ref> Some other dialects of Lisp, like [[Emacs Lisp]], still use dynamic scope by default. Emacs Lisp now has lexical scope available on a per-buffer basis.<ref name=":0">{{cite web |url=https://www.emacswiki.org/emacs/LexicalBinding |title=Lexical Binding |website=EmacsWiki |access-date=October 20, 2018 |quote=Emacs 24 has optional lexical binding, which can be enabled on a per-buffer basis. }}</ref>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Scope (computer science)
(section)
Add topic