[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: what is the problem?
Jeremy, as it turns out this form of "fear" isn't new. Dave Hanson (at the
time UofA, Tucson, now at MS Research) wrote a technical report with a
title like "Nested Scoping Considered Harmful". -- Matthias
> Content-Type: text/plain; charset=us-ascii
> Date: Tue, 18 Dec 2001 16:25:27 -0500 (EST)
> From: jeremy@alum.mit.edu (Jeremy Hylton)
> Cc: Paul Prescod <paul@prescod.net>, ll1-discuss@ai.mit.edu
> Reply-To: jeremy@zope.com
> Sender: owner-ll1-discuss@ai.mit.edu
> Precedence: bulk
>
> >>>>> "PG" == Paul Graham <paulgraham@yahoo.com> writes:
>
> PG> Perl has been getting Lispier, but it started further away from
> PG> Lisp than Python and Ruby. As a first approximation, Python
> PG> seems to be an inadvertant reinvention of a 1970s
> PG> dynamically-scoped Lisp (except for s-expressions and thus
> PG> macros). It seems as if these ideas came to Python indirectly
> PG> via Modula-3, which was based in part on Lisp.
>
> Python wasn't dynamically scoped. It didn't support nested scopes at
> all. Every function regardless of whether it was nested inside
> another function had access to two namespaces -- the local namespace
> and the global/builtin namespace. The determination of the global
> namespace is static; it's the globals where the function was defined.
>
> I believe these odd scoping rules are the result of some bad
> experiences with Pascal, where nesting functions was one of the few
> structuring techniques for large programs. So several people were
> familiar with large Pascal programs that were very hard to understand
> because they used many nested functions. Python, then, wanted to
> discourage this style of programming.
>
> Jeremy
>