[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: T vs. franz
- To: HGA@MIT-MC.ARPA
- Subject: Re: T vs. franz
- From: masinter.pa@PARC-MAXC.ARPA
- Date: Mon, 6 Feb 84 21:12:00 GMT
- Cc: franz-friends@Berkeley
- In-reply-to: Harold G. Ancell <HGA@MIT-MC.ARPA>'s message of 6 Feb 84 08:59 EST
- Original-date: 6 Feb 84 13:12 PST
"I can't understand how anyone can defend a defaultly dynamically scoped
Lisp except on the grounds of tradition. A dynamically scoped lisp
violates referential transparency: i.e. merely by chosing a variable
name unwisely and using it as a free variable you can get screwed if
someone else's function you call temporally binds the variable."
It is possible that you don't understand how dynamic scoping works.
Dynamic scoping does not violate referential transparency. If a function
call another which binds a variable, the callee's actions on its
temporary variable does not affect the value as seen by the caller. Did
you mean something else?
"Big packages written in dynamically scoped lisps tend to consist of
lots of top level functions, and to avoid naming conflicts people tend
to use very long variable names like subprogram-name-do-the-right-thing.
Lexically scoped lisps allow the use of Algol style block structure; you
can hide functions that are used only by one superior function."
The question only has to do with dynamic scoping of VARIABLES: the issue
of the name scope of FUNCTIONS can be separated and is in most commonly
used Lisp dialects.
While function-name scope is an important issue, it is partially
orthogonal to the lexical vs. dynamic scoping debate.
"Another important point is that in lexically scoped lisps the
semantics of the interpreter and the compiler are the same."
One way to avoid the problem in dynamically scoped lisps is to fix the
compiler to preserve the interpreters symantics (all variables are
"special" by default.) (This is done in Interlisp.)
That is to say, it is quite possible to have a dynamicly scoped lisp
where the semantics interpreted and compiled code is the same.
"Elegance" and "cleanliness" may argue for lexical scoping, but these
are terms which do not have objective metrics. (One judges them by
"Referential transparency" and "consistent semantics of interpreted and
compiled code" are better criteria, but lexical scoping does not clearly
dominate dynamic scoping using those criteria.