Python's Lisp heritage

Paul Foley see at below
Tue Apr 23 07:37:07 EDT 2002


On Mon, 22 Apr 2002 23:35:27 -0700, James J Besemer wrote:

>> On Sun, 21 Apr 2002 02:32:29 -0700, James J Besemer wrote:
>> 
>> A lot of people think "Lisp" means "Scheme".
>> Scheme sucks, so they think "Lisp" sucks.

> That complaint seems specific to the Lisp community.  I don't sense that a lot of
> people here know either language well enough to be making that particular complaint.

People who're already knowledgeable about Lisp obviously aren't
susceptible to thinking that Lisp sucks just because they don't like
Scheme.  The problem is only with people who _don't_ know Lisp, who
keep hearing that Scheme is Lisp.

>> Well, that's not entirely true.  Lisp has always used lexical scoping
>> in compiled code.  There used to be a difference between compiled and
>> interpreted code, though, where the interpreter used (only) dynamic
>> scope.

> My statement was 100% accurate, as "original Lisp" had no notion of compiled code.

See McCarthy's 1960 paper, available from his web site.  Page 22,
immediately under the heading "The LISP Programming System":

  ...  [LISP] has been used, or will be used for:

  1) Writing a compiler to compile LISP programs into machine code.


John Aycock's paper entitled "A Brief History of Just-In-Time" says:

  Instead we suspect that the earliest published work on JIT
  compilation is McCarthy's 1960 LISP paper. He mentions compilation
  of functions into machine language, a process fast enough that the
  compiler's output needn't be saved [McCarthy 1960]. This can be seen
  as an inevitable result of having programs and data share the same
  notation [McCarthy 1981].


[Also see MIT AI Memo 39, on the LISP 1.5 compiler]

> The original semantics (as formally defined in Lisp itself [McCarthy]) called for
> dynamic binding.  Most original implementations did it that way, many later

ISTM reading somewhere that the dynamic scoping in early
implementations was actually the result of an error; compiled Lisp
has always used lexical scoping (for normal variables; e.g., those
not declared "special" or "common" in LISP 1.5)

Where do you think dynamic scope is called for?

> However, you have to admit that having to surround virtually each and every
> statement, expression, sub-expression, etc. in a pair of parentheses is at the very
> least more tedious and error prone for the programmer than, say, using operator
> precedence to organize arithmetic, semicolons or newlines to separate statements and
> braces or indentation to group statements.

No I don't have to admit that...I don't even have to admit that there
are any parentheses in Lisp :-)  [parentheses are only present in the
printed representation, to provide the necessary structure; they're
not part of the code -- if you work with a structure editor in a Lisp
system, instead of a text editor, there are no parentheses anywhere]

In any case, parentheses are not used around sub-expressions, or to
separate or group statements.  They're only used (in evaluated
contexts) for "function" calls, and most other languages, including
Python, use parentheses for that purpose, too:

 Python: foo(x)
 Lisp: (foo x)

Same number of parentheses, right?  I'd expect Lisp syntax to be
rather less error-prone, if anything, since it's much simpler
[there're no special syntaxes for specific data types, operator
precedence rules, etc., etc., to remember; just a single, clean
and obvious rule, and a small handful of "special operators" with
nonstandard evaluation rules (20 in ANSI Common Lisp, IIRC)]

> prefer controlling the semantics with an "Algol-like" syntax.

Which is also possible in Lisp, of course; in fact, Lisp was
originally intended to have an "Algol-like" syntax (McCarthy's
M-expressions) on top of S expressions...

>> [And it's worth noting that, as with other aspects of Lisp, people
>> just keep reinventing it, badly --

> Hmmm.... I was recently accused of making this claim, which is entirely untrue.

Eh?  What's untrue?  The claim or that you made it?

-- 
In modern physics, the more logical you are, the more wrong you are.
                                                           -- Lama Govinda
(setq reply-to
  (concatenate 'string "Paul Foley " "<mycroft" '(#\@) "actrix.gen.nz>"))



More information about the Python-list mailing list