Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Live long and prosper. -- Spock, "Amok Time", stardate 3372.7


devel / comp.lang.lisp / History of lexical scope in Lisp

SubjectAuthor
* History of lexical scope in LispPaul Rubin
+* Re: History of lexical scope in LispJeff Barnett
|`* Re: History of lexical scope in LispLawrence D'Oliveiro
| +- Re: History of lexical scope in LispKaz Kylheku
| `* Re: History of lexical scope in LispJeff Barnett
|  +* Re: History of lexical scope in LispLawrence D'Oliveiro
|  |`* Re: History of lexical scope in LispJeff Barnett
|  | `* Re: History of lexical scope in LispLawrence D'Oliveiro
|  |  `* Re: History of lexical scope in LispJeff Barnett
|  |   +* Re: History of lexical scope in LispLawrence D'Oliveiro
|  |   |`* Re: History of lexical scope in LispJeff Barnett
|  |   | `- Re: History of lexical scope in LispLawrence D'Oliveiro
|  |   `* Re: History of lexical scope in Lispalbert
|  |    +- Re: History of lexical scope in LispLawrence D'Oliveiro
|  |    `- Re: History of lexical scope in LispGeorge Neuner
|  `- Re: History of lexical scope in LispKaz Kylheku
+* Re: History of lexical scope in LispRobert Brown
|`* Re: History of lexical scope in LispLawrence D'Oliveiro
| `* Re: History of lexical scope in LispRobert Brown
|  `- Re: History of lexical scope in LispLawrence D'Oliveiro
+- Re: History of lexical scope in LispKaz Kylheku
+* Re: History of lexical scope in LispDidier Verna
|`- Re: History of lexical scope in LispLawrence D'Oliveiro
`- Re: History of lexical scope in LispJohanne Fairchild

1
History of lexical scope in Lisp

<874jd7z5nf.fsf@nightsong.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18088&group=comp.lang.lisp#18088

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!nntp.comgw.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: no.email@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.lisp
Subject: History of lexical scope in Lisp
Date: Fri, 15 Mar 2024 11:55:32 -0700
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <874jd7z5nf.fsf@nightsong.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="1c4c328df770804111002d845ef94b32";
logging-data="2552654"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19z7sthmkbjhWI6XEMR6DRz"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:j/1AyQTFP/7yimvoPjzk3ShimiI=
sha1:6hs8lkQ0+RHfQJDzKGKKBORaOXU=
 by: Paul Rubin - Fri, 15 Mar 2024 18:55 UTC

Does anyone know when lexical scope started appearing in Lisp? Not
counting Scheme, did it exist in predecessors of Common Lisp? Was it
used much? Is it really true that Common Lisp had both lexical and
dynamic scope in order to support older code that was written relying on
dynamic scope and was too hard to convert?

Thanks. This topic came up in the Forth group.

Re: History of lexical scope in Lisp

<ut2gnj$2g8k5$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18089&group=comp.lang.lisp#18089

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jbb@notatt.com (Jeff Barnett)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Fri, 15 Mar 2024 16:05:37 -0600
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <ut2gnj$2g8k5$1@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 15 Mar 2024 22:05:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a1fc9323b3988102bc6fa7a73a8c7ec5";
logging-data="2630277"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//MpTXRoryGKpJp3mch4op8SId9Wk6Is8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:hIdK4zljLnyw6hFmqNWo2iXkxEg=
In-Reply-To: <874jd7z5nf.fsf@nightsong.com>
Content-Language: en-US
 by: Jeff Barnett - Fri, 15 Mar 2024 22:05 UTC

On 3/15/2024 12:55 PM, Paul Rubin wrote:
> Does anyone know when lexical scope started appearing in Lisp? Not
> counting Scheme, did it exist in predecessors of Common Lisp? Was it
> used much? Is it really true that Common Lisp had both lexical and
> dynamic scope in order to support older code that was written relying on
> dynamic scope and was too hard to convert?
>
> Thanks. This topic came up in the Forth group.

I'll comment on only a part of your questions, namely whether CL had
dynamic scope only for compatibility? The view that I and many others
had was that compatibility made it a must AND:

Once you have had the programming convenience of using dynamic scope,
you would miss it terribly in a lexical-only language, or worse, in
something like the old FORTRAN assembler-level scope. Another argument
that I have not seen debated but may be significant is that the CL Error
System -- the programming primitives and error class structures don't
make a lot of sense in lexical only. The error mechanisms like catch
have meanings that include phrases such as "while executing this. I'm
available to handle that".

The availability of such fine grained control structures makes many
typical Lisp non-hierarchical reasoning* programs possible. I believe
that the early and middle AI communities were drawn to Lisp-like
development tools because of these possibilities.

* By non-hierarchical reasoning, I'm thinking of Simon's "almost
decomposable systems" ideas.
--
Jeff Barnett

Re: History of lexical scope in Lisp

<ut2hvh$2gft8$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18090&group=comp.lang.lisp#18090

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Fri, 15 Mar 2024 22:26:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <ut2hvh$2gft8$1@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <ut2gnj$2g8k5$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 15 Mar 2024 22:26:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="923cb71133c4c2bd336d691e5929520c";
logging-data="2637736"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Q7zJxt3FOexUqvwzUu4Ir"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:hsjwZBcMqpm4Bu0zseRD/n1k520=
 by: Lawrence D'Oliv - Fri, 15 Mar 2024 22:26 UTC

On Fri, 15 Mar 2024 16:05:37 -0600, Jeff Barnett wrote:

> Once you have had the programming convenience of using dynamic scope,
> you would miss it terribly in a lexical-only language, or worse, in
> something like the old FORTRAN assembler-level scope. Another argument
> that I have not seen debated but may be significant is that the CL Error
> System -- the programming primitives and error class structures don't
> make a lot of sense in lexical only. The error mechanisms like catch
> have meanings that include phrases such as "while executing this. I'm
> available to handle that".

Lexical binding has always been understood to apply to references to
definitions of identifiers. Exception handlers are dynamically-installed
(lexical-based exception handling doesn’t make any sense), nevertheless
the names of the defined exceptions being handled are still lexically-
bound.

This is how it works in every rationally-designed language.

Re: History of lexical scope in Lisp

<20240315155740.155@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18091&group=comp.lang.lisp#18091

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Fri, 15 Mar 2024 23:04:59 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <20240315155740.155@kylheku.com>
References: <874jd7z5nf.fsf@nightsong.com> <ut2gnj$2g8k5$1@dont-email.me>
<ut2hvh$2gft8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 15 Mar 2024 23:04:59 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1a42fc917c3606d23239d5314488ebcf";
logging-data="2649497"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9bcDRShnGDIUMWX0le2OVzoDwVZ56uBU="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:Pj+HBYQbU2ARYJjlutb9cyAUEW8=
 by: Kaz Kylheku - Fri, 15 Mar 2024 23:04 UTC

On 2024-03-15, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
> On Fri, 15 Mar 2024 16:05:37 -0600, Jeff Barnett wrote:
>
>> Once you have had the programming convenience of using dynamic scope,
>> you would miss it terribly in a lexical-only language, or worse, in
>> something like the old FORTRAN assembler-level scope. Another argument
>> that I have not seen debated but may be significant is that the CL Error
>> System -- the programming primitives and error class structures don't
>> make a lot of sense in lexical only. The error mechanisms like catch
>> have meanings that include phrases such as "while executing this. I'm
>> available to handle that".
>
> Lexical binding has always been understood to apply to references to
> definitions of identifiers. Exception handlers are dynamically-installed
> (lexical-based exception handling doesn’t make any sense), nevertheless
> the names of the defined exceptions being handled are still lexically-
> bound.
>
> This is how it works in every rationally-designed language.

Names of exceptions (conditions) are not lexically bound in Common Lisp.

They are pervasive, similarly to class names.

Lexically scoped exception handling does make sense, during those
sections of the handling when a lexical scope isn't being abandoned.

If the termination point of an exception is in lexical scope of the
origin, then the case can be made for handling the entire episode
lexically, including the unwinding.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: History of lexical scope in Lisp

<871q8bja7c.fsf@gmail.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18092&group=comp.lang.lisp#18092

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: robert.brown@gmail.com (Robert Brown)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Fri, 15 Mar 2024 20:23:51 -0400
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <871q8bja7c.fsf@gmail.com>
References: <874jd7z5nf.fsf@nightsong.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="7504f8db4c33edb5221b67dffc7315d3";
logging-data="2677038"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/xPfHdXnzSLamlPLL1twXR"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:ifgOHJFNrbYmjTAtc6xpQCbelFY=
sha1:j5J55x6TRg0k7HRF1G89hUNYEIM=
 by: Robert Brown - Sat, 16 Mar 2024 00:23 UTC

Paul Rubin <no.email@nospam.invalid> writes:

> Is it really true that Common Lisp had both lexical and dynamic scope
> in order to support older code that was written relying on dynamic
> scope and was too hard to convert?

No. I'd say Common Lisp has both lexical and dynamic scope because both
are very useful. For instance, the Guice dependency injection framework
for Java implements @RequestScoped settings, which are dynamically
scoped and thread local. Guice wouldn't need that feature if Java
natively supported dynamically-scoped variables.

Re: History of lexical scope in Lisp

<ut2r5n$2i048$4@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18093&group=comp.lang.lisp#18093

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sat, 16 Mar 2024 01:03:52 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <ut2r5n$2i048$4@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <871q8bja7c.fsf@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 16 Mar 2024 01:03:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f7920a21ec63febd4cd65eac0ef9a9b4";
logging-data="2687112"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/r5djuRPRRTvxzD3iqFM9J"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:a9YL6MmkW5tdu8lJeK/5xLFAfLg=
 by: Lawrence D'Oliv - Sat, 16 Mar 2024 01:03 UTC

On Fri, 15 Mar 2024 20:23:51 -0400, Robert Brown wrote:

> For instance, the Guice dependency injection framework
> for Java implements @RequestScoped settings, which are dynamically
> scoped and thread local.

Can’t find any mention of “dynamic” scoping in the docs
<https://github.com/google/guice/wiki/Scopes>. “@RequestScoped” just
seems to mean what it says: the scope is per-request.

> Guice wouldn't need that feature if Java
> natively supported dynamically-scoped variables.

It seems to me the effect can be achieved more simply by allowing
access to instance methods as first-class objects, as you can do in
Python, e.g.

request_inst = Request(...)
# class instantiation
request_meth = request_inst.meth
# method access

But as usual, Java insists on doing things in a complicated way...

Re: History of lexical scope in Lisp

<20240315192646.51@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18094&group=comp.lang.lisp#18094

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sat, 16 Mar 2024 02:37:51 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <20240315192646.51@kylheku.com>
References: <874jd7z5nf.fsf@nightsong.com>
Injection-Date: Sat, 16 Mar 2024 02:37:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1a42fc917c3606d23239d5314488ebcf";
logging-data="2843346"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19H7vwZONti66XC5uXKEws7WP5wTPrN+1I="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:rq1Wwi9NdekTbQRUMdVqeGar5vY=
 by: Kaz Kylheku - Sat, 16 Mar 2024 02:37 UTC

On 2024-03-15, Paul Rubin <no.email@nospam.invalid> wrote:
> Does anyone know when lexical scope started appearing in Lisp? Not
> counting Scheme, did it exist in predecessors of Common Lisp? Was it
> used much? Is it really true that Common Lisp had both lexical and
> dynamic scope in order to support older code that was written relying on
> dynamic scope and was too hard to convert?

Global variables are dynamically scoped in Common Lisp; the standard
language doesn't provide for global variables that are not dynamically
scoped: "dynamic variable", "global variable" and "top-level variable"
refer to the same thing. Common Lisp's lexical scope design therefore
isn't "total" in a sense; it doesn't provide top-level variables.

New Common Lisp code continues to make use of dynamic scope.

Important predefined variables such as the standard streams (e.g.
*standard-output*) are dynamic variables. By locally binding
*standard-output* we can redirect standard output to a different
stream.

In multithreaded Common Lisp implementations, dynamically scoped
variables provide thread-local storage (as an extension to the
language). If each thread can have its own independent binding of a
dynamic variable, it means that the symbol serves as a key
to a thread-specific storage location.

There are good reasons to use dynamic variables in newly written Lisp
code.

For instance, a context handle (e.g. database handle) that rarely
changes and that is passed around in numerous API calls can be a special
variable, and then it doesn't have to be repated in all those calls.
Yet if it has to take on different values, there is a clean way to do
that.

The aforementioned standard streams are such context handles. For
instance when we call (write-strin "abc"), the default destination is
*standard-output*; it need not be mentioned, if desired. The function
will use the current value of the dynamic variable *standard-output*.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: History of lexical scope in Lisp

<ut3f7t$2p3sa$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18095&group=comp.lang.lisp#18095

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jbb@notatt.com (Jeff Barnett)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sat, 16 Mar 2024 00:46:21 -0600
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <ut3f7t$2p3sa$1@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <ut2gnj$2g8k5$1@dont-email.me>
<ut2hvh$2gft8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64
Injection-Date: Sat, 16 Mar 2024 06:46:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="48524497b55bd53b7a996189ae1738f0";
logging-data="2920330"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18E5saLCtPWYizEjSqyBdKT6Ro0eyjYCu0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:38KmexV4h0T5Z9eyXhenWFEsn9Y=
Content-Language: en-US
In-Reply-To: <ut2hvh$2gft8$1@dont-email.me>
 by: Jeff Barnett - Sat, 16 Mar 2024 06:46 UTC

On 3/15/2024 4:26 PM, Lawrence D'Oliveiro wrote:
> On Fri, 15 Mar 2024 16:05:37 -0600, Jeff Barnett wrote:
>
>> Once you have had the programming convenience of using dynamic scope,
>> you would miss it terribly in a lexical-only language, or worse, in
>> something like the old FORTRAN assembler-level scope. Another argument
>> that I have not seen debated but may be significant is that the CL Error
>> System -- the programming primitives and error class structures don't
>> make a lot of sense in lexical only. The error mechanisms like catch
>> have meanings that include phrases such as "while executing this. I'm
>> available to handle that".
>
> Lexical binding has always been understood to apply to references to
> definitions of identifiers. Exception handlers are dynamically-installed
> (lexical-based exception handling doesn’t make any sense), nevertheless
> the names of the defined exceptions being handled are still lexically-
> bound.
>
> This is how it works in every rationally-designed language.
First off, I believe that many if not most exception-related primitives
expand in terms of dynamic variables. And second, it would be amusing to
unwind to an environment that is lexically alive but execution dead-
think about restarting the contexts that were abandoned.
--
Jeff Barnett

Re: History of lexical scope in Lisp

<ut3hlt$2pi20$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18096&group=comp.lang.lisp#18096

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sat, 16 Mar 2024 07:27:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 69
Message-ID: <ut3hlt$2pi20$1@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <ut2gnj$2g8k5$1@dont-email.me>
<ut2hvh$2gft8$1@dont-email.me> <ut3f7t$2p3sa$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 16 Mar 2024 07:27:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f7920a21ec63febd4cd65eac0ef9a9b4";
logging-data="2934848"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19oovGtNeGj40oCTOyeqJ1x"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:RL3u1YYzBv1rQHFIIqH0uBlB3BU=
 by: Lawrence D'Oliv - Sat, 16 Mar 2024 07:27 UTC

On Sat, 16 Mar 2024 00:46:21 -0600, Jeff Barnett wrote:

> First off, I believe that many if not most exception-related primitives
> expand in terms of dynamic variables.

Consider the following Python example:

class MyException1(Exception) :
pass
#end MyException1

class MyException2(Exception) :
pass
#end MyException2

def func1() :
raise MyException1
#end func1

def func2() :
raise MyException2
#end func2

def func3() :
class MyException1(Exception) :
pass
#end MyException1

try :
func1()
except MyException1 :
# will never get here
print("caught MyException1 in func3")
#end try
#end func3

def func4() :
try :
func2()
except MyException2 :
print("caught MyException2 in func4")
#end try
#end func4

for f in (func1, func2, func3, func4) :
try :
print("* call %s" % f.__name__)
f()
except MyException1 :
print("caught MyException1 at top level")
except MyException2 :
print("caught MyException2 at top level")
#end try
#end for

Here is the output it produces:

* call func1
caught MyException1 at top level
* call func2
caught MyException2 at top level
* call func3
caught MyException1 at top level
* call func4
caught MyException2 in func4

func4 shows how the search for a handler is based on dynamic execution
nesting. func3 shows how exception matching is based on lexical
scoping.

Re: History of lexical scope in Lisp

<87il1mgpk1.fsf@gmail.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18098&group=comp.lang.lisp#18098

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: robert.brown@gmail.com (Robert Brown)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sat, 16 Mar 2024 11:32:46 -0400
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <87il1mgpk1.fsf@gmail.com>
References: <874jd7z5nf.fsf@nightsong.com> <871q8bja7c.fsf@gmail.com>
<ut2r5n$2i048$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="e8d0bdb69302ec0b781889a4048ecef4";
logging-data="3115431"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192WDhpJmQd6PfXJK+12t32"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:c2ZVz24jzYehx5KSkCD3De/rXbA=
sha1:NU1I4wdgtt9AbXsDELYKMvFJPx4=
 by: Robert Brown - Sat, 16 Mar 2024 15:32 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:

> On Fri, 15 Mar 2024 20:23:51 -0400, Robert Brown wrote:
>
>> For instance, the Guice dependency injection framework
>> for Java implements @RequestScoped settings, which are dynamically
>> scoped and thread local.
>
> Can’t find any mention of “dynamic” scoping in the docs
> <https://github.com/google/guice/wiki/Scopes>. “@RequestScoped” just
> seems to mean what it says: the scope is per-request.

The use of thread local state to store request scoped Guice bindings is
discussed in this thread:

https://groups.google.com/g/google-guice/c/gDonVGO1wjY/m/_SSi4CcQAJYJ

Re: History of lexical scope in Lisp

<20240316093534.951@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18099&group=comp.lang.lisp#18099

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sat, 16 Mar 2024 16:54:05 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 131
Message-ID: <20240316093534.951@kylheku.com>
References: <874jd7z5nf.fsf@nightsong.com> <ut2gnj$2g8k5$1@dont-email.me>
<ut2hvh$2gft8$1@dont-email.me> <ut3f7t$2p3sa$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 16 Mar 2024 16:54:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1a42fc917c3606d23239d5314488ebcf";
logging-data="3150899"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sN+TXIAqXNHuBZgitqhEcppLn92GaskM="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:r4dErkiwd+FQ7KetxuRNmdx0P1Y=
 by: Kaz Kylheku - Sat, 16 Mar 2024 16:54 UTC

On 2024-03-16, Jeff Barnett <jbb@notatt.com> wrote:
> On 3/15/2024 4:26 PM, Lawrence D'Oliveiro wrote:
>> On Fri, 15 Mar 2024 16:05:37 -0600, Jeff Barnett wrote:
>>
>>> Once you have had the programming convenience of using dynamic scope,
>>> you would miss it terribly in a lexical-only language, or worse, in
>>> something like the old FORTRAN assembler-level scope. Another argument
>>> that I have not seen debated but may be significant is that the CL Error
>>> System -- the programming primitives and error class structures don't
>>> make a lot of sense in lexical only. The error mechanisms like catch
>>> have meanings that include phrases such as "while executing this. I'm
>>> available to handle that".
>>
>> Lexical binding has always been understood to apply to references to
>> definitions of identifiers. Exception handlers are dynamically-installed
>> (lexical-based exception handling doesn’t make any sense), nevertheless
>> the names of the defined exceptions being handled are still lexically-
>> bound.
>>
>> This is how it works in every rationally-designed language.
>
> First off, I believe that many if not most exception-related primitives
> expand in terms of dynamic variables. And second, it would be amusing to
> unwind to an environment that is lexically alive but execution dead-
> think about restarting the contexts that were abandoned.

That might happen when you call a closure that was saved in such
an environment which was then dynamically abandoned.

When resuming a continuation captured in such an environment, though,
the dynamics have to appear intact.

(defun grandkid ()
(unwind-protect
(yield-from parent 'in-grandkid)
(put-line "returning from grandkid")))
(defun kid ()
(unwind-protect
(progn
(yield-from parent 'in-kid)
(grandkid))
(put-line "returning from kid")))

(defun parent ()
(unwind-protect
(progn
(yield-from parent 'in-parent)
(kid))
(put-line "returning from parent")))

(let ((fn (obtain (parent))))
(prinl 'a)
(prinl (call fn))
(prinl 'b)
(prinl (call fn))
(prinl 'c)
(prinl (call fn))
(prinl 'd)
(prinl (call fn))
(prinl 'e))

Run:

$ txr cont.tl
a
in-parent
b
in-kid
c
in-grandkid
d
returning from grandkid
returning from kid
returning from parent
nil
e

When (call fn) resumes the delimited continuation, the stack linkage is all
there: the unwind protect exit points, and all else. Dynamic variable bindings
also, though that is not apparent in this example. If you resume a continuation
into somwhere where *stdout* is redirected to a string, it's redirected to a
string via dynamic binding, that redirection is correctly observed.

To make this work, I didn't even give a second thought to the horrendously
impractical "dynamic-wind", which is dead on arrival from a feasability
point of view.

How it works is that the yield-from invocations perform an "absconding"
dynamic control transfer. An absconding control transfer is like a regular
dynamic control transfer, except it performs no unwinding.

1> (block foo (unwind-protect (sys:abscond-from foo 42) (prinl 'unwind)))
42
2> (block foo (unwind-protect (return-from foo 42) (prinl 'notprinted)))
notprinted
42

Abscond is a sharp knife, so it's kept in the system package, though
it is a documented feature.

If we resume the came continuation, we can repeatedly invoke the
same unwinding:

1> (block nil
(unwind-protect
(sys:capture-cont nil 'identity) ;; capture up to nil block
(prinl 'unwind)))
unwind
#<intrinsic fun: 1 param>
2> [*1 42] ;; call continuation
unwind
42
3> [*1 42]
unwind
42
4> [*1 42]
unwind
42
5> [*1 42]
unwind
42

(The yield stuff avoids this by updating the yield contexts to new
continuations which resume from the previously yielded point,
like a cooperative thread.)

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: History of lexical scope in Lisp

<ut54ne$33m2r$5@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18100&group=comp.lang.lisp#18100

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sat, 16 Mar 2024 21:59:10 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <ut54ne$33m2r$5@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <871q8bja7c.fsf@gmail.com>
<ut2r5n$2i048$4@dont-email.me> <87il1mgpk1.fsf@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 16 Mar 2024 21:59:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f7920a21ec63febd4cd65eac0ef9a9b4";
logging-data="3266651"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bHHAE3J7EyI3amDKe3gDR"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:E59pZmPgi+G4vLRkTJH9o3PmK9M=
 by: Lawrence D'Oliv - Sat, 16 Mar 2024 21:59 UTC

On Sat, 16 Mar 2024 11:32:46 -0400, Robert Brown wrote:

> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>
>> On Fri, 15 Mar 2024 20:23:51 -0400, Robert Brown wrote:
>>
>>> For instance, the Guice dependency injection framework for Java
>>> implements @RequestScoped settings, which are dynamically scoped and
>>> thread local.
>>
>> Can’t find any mention of “dynamic” scoping in the docs
>> <https://github.com/google/guice/wiki/Scopes>. “@RequestScoped” just
>> seems to mean what it says: the scope is per-request.
>
> The use of thread local state to store request scoped Guice bindings is
> discussed in this thread:
>
> https://groups.google.com/g/google-guice/c/gDonVGO1wjY/m/_SSi4CcQAJYJ

You mean the commenter who says “I'm not saying this is
often (or even ever) a good thing to do; I'm just illustrating the
technique”?

Re: History of lexical scope in Lisp

<ut5u5i$3c0e6$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18101&group=comp.lang.lisp#18101

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jbb@notatt.com (Jeff Barnett)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sat, 16 Mar 2024 23:13:20 -0600
Organization: A noiseless patient Spider
Lines: 100
Message-ID: <ut5u5i$3c0e6$1@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <ut2gnj$2g8k5$1@dont-email.me>
<ut2hvh$2gft8$1@dont-email.me> <ut3f7t$2p3sa$1@dont-email.me>
<ut3hlt$2pi20$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 17 Mar 2024 05:13:23 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7253f92624daadea9204047ea55daaae";
logging-data="3539398"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4hLC+LIBGltokDGqBD1BTh2YLvlMH/48="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:6GOoQORkyxsV5V4FZyQTHzQA+JQ=
In-Reply-To: <ut3hlt$2pi20$1@dont-email.me>
Content-Language: en-US
 by: Jeff Barnett - Sun, 17 Mar 2024 05:13 UTC

On 3/16/2024 1:27 AM, Lawrence D'Oliveiro wrote:
> On Sat, 16 Mar 2024 00:46:21 -0600, Jeff Barnett wrote:
>
>> First off, I believe that many if not most exception-related primitives
>> expand in terms of dynamic variables.
>
> Consider the following Python example:
>
> class MyException1(Exception) :
> pass
> #end MyException1
>
> class MyException2(Exception) :
> pass
> #end MyException2
>
> def func1() :
> raise MyException1
> #end func1
>
> def func2() :
> raise MyException2
> #end func2
>
> def func3() :
> class MyException1(Exception) :
> pass
> #end MyException1
>
> try :
> func1()
> except MyException1 :
> # will never get here
> print("caught MyException1 in func3")
> #end try
> #end func3
>
> def func4() :
> try :
> func2()
> except MyException2 :
> print("caught MyException2 in func4")
> #end try
> #end func4
>
> for f in (func1, func2, func3, func4) :
> try :
> print("* call %s" % f.__name__)
> f()
> except MyException1 :
> print("caught MyException1 at top level")
> except MyException2 :
> print("caught MyException2 at top level")
> #end try
> #end for
>
> Here is the output it produces:
>
> * call func1
> caught MyException1 at top level
> * call func2
> caught MyException2 at top level
> * call func3
> caught MyException1 at top level
> * call func4
> caught MyException2 in func4
>
> func4 shows how the search for a handler is based on dynamic execution
> nesting. func3 shows how exception matching is based on lexical
> scoping.

Unfortunately, I don't speak Python. However if your point is that you
can build "simulations" of one sort of scoping out of primitives for
another sort, I agree.

In fact Doug Pintar and I invented and used a language called CRISP
(https://www.softwarepreservation.org/projects/LISP/crisp_ibm370_sdc) in
the 1070s. It was used to implement some interesting speech
understanding systems as part of the DARPA SUR Program. CRISP Allowed
local and dynamic bindings and stack segments including bindings,
catches, and return points where represented. There where primitives
that allowed these stack segments to be elements of three types of
trees: binding trees where dynamic bindings not located in one segment
where sought in the parent segment; resume trees where segment
executions did a return that was not handled in the current segment were
reflected to the parent segment; and handler trees where a throw not
handled by the executing segment was continued into the parent segment.
The "highest" node in all trees was the global context. The parent-child
relation in all trees could be rearranged under program control. Out of
the related primitives, e.g., eval-in(exp, segment) you could construct
pretty much whatever binding, control. and error handling structure that
you needed. The reason for this baroque approach is that when we started
constructing speech systems we had absolutely no idea what program
organization structures would be convenient.

The above was inspired by some papers using the rubric "spaghetti
stacks". Don't remember the authors but Danny Bobrow might have been
implicated.
--
Jeff Barnett

Re: History of lexical scope in Lisp

<ut5vjg$3c7pv$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18102&group=comp.lang.lisp#18102

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sun, 17 Mar 2024 05:37:52 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <ut5vjg$3c7pv$2@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <ut2gnj$2g8k5$1@dont-email.me>
<ut2hvh$2gft8$1@dont-email.me> <ut3f7t$2p3sa$1@dont-email.me>
<ut3hlt$2pi20$1@dont-email.me> <ut5u5i$3c0e6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 17 Mar 2024 05:37:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="31a11bef4058be5ae592f48d8f7580f7";
logging-data="3546943"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18J66mTCNjnZDIa86s0Ln1o"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:to9jI8p6MnGNgrEQ2AJutWrcIHI=
 by: Lawrence D'Oliv - Sun, 17 Mar 2024 05:37 UTC

On Sat, 16 Mar 2024 23:13:20 -0600, Jeff Barnett wrote:

> However if your point is that you can build "simulations" of one sort of
> scoping out of primitives for another sort ...

No, my point was that there seems to be no need for dynamic scoping, if
the only excuse anyone can come up for needing it comes out of exception
handling.

Re: History of lexical scope in Lisp

<65f6baad$0$5286$426a74cc@news.free.fr>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18103&group=comp.lang.lisp#18103

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!cleanfeed1-b.proxad.net!nnrp2-2.free.fr!not-for-mail
From: didier@didierverna.net (Didier Verna)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Organization: EPITA Research and Development Laboratory
Distribution: world
References: <874jd7z5nf.fsf@nightsong.com>
User-Agent: Gnus/5.13 (Gnus v5.13)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEVZeUBeISYbIRa+uXTR
0c2xa1rmi5tKAAACT0lEQVQ4jVWUwZLjIAxEZTPcLVK+A1u5OwvctwrnDkv4/1+ZFraTGeJyKnpu
yWpByGPZWe7+nmLO4VwkkT9/B7jhN8A+1gFE4XohUvGX4jY7v3TSExsd46kICZHmnA6998m4dimY
jdfa+iaP5WTsHj811mKXI8GeLskA1LavE+yPm9xPoOZwxffMPxR6e13xEB8qf8AzXvEQn+sPhX4L
0PvUPg2qd4UUQlVvoK4SOfwGdIEkWert3aB+fUqEUJahMAu5C6TKawsVrmQoVJopInvcn9XAnlCH
K8Skpi2GYlYRMAP4V94zmXugLcZceE/9AE6Nt/rKNL32wG7f2HvmBoDRk7dhK68nUdsfxlUB/i4K
54lguuyBrbYEsPFt2G6JCqaBCVaOmC/g2hIAbQSrwmijhYbJrzISIlynh09uOfXWuaZEhEx0uo5n
Q197r0h3AFGgp17XhEz4Wjca60gl7bUqoK/qIEcqMQTZOhfNeCP0R3TUNjBkCBoVBBWdICSRVJQY
eRCfKJ5bakgmTSoImtlKe3gpAQW94+kZ8QlDxJR0lFRcum4EP4ZkwW7ImKJIqGjE/YQGncVQsPlz
L5KLOnvyBhC9eyXgGO1SHFk7I5vFR2MvgBwSKh7FJztsFADfveN1IuNpIbkUJT2AkePFy2zJEE4y
3lk9QPIkpxpG4R/B0uzASP1zukvcs+bF2P/I76CZ1G78sXj1y6yQZEMhW9T+OOKOu+dCM4jDWcao
8iGBvygjZtAi88WRSIeA1+oWKwrYzsvXnnOV5wGScYr8NyBru1vr/U3zAAAAAElFTkSuQmCC
X-Attribution: dvl
X-Web: http://www.didierverna.com
X-Url: http://www.didierverna.com
X-Home-Page: http://www.didierverna.com
Date: Sun, 17 Mar 2024 10:41:01 +0100
Cancel-Lock: sha1:uI9A1bs65fytamd2HaaBlgh1O20=
MIME-Version: 1.0
Content-Type: text/plain
Lines: 22
Message-ID: <65f6baad$0$5286$426a74cc@news.free.fr>
NNTP-Posting-Date: 17 Mar 2024 10:41:01 CET
NNTP-Posting-Host: 78.243.179.1
X-Trace: 1710668461 news-2.free.fr 5286 78.243.179.1:59537
X-Complaints-To: abuse@proxad.net
 by: Didier Verna - Sun, 17 Mar 2024 09:41 UTC

Paul Rubin <no.email@nospam.invalid> wrote:

> Does anyone know when lexical scope started appearing in Lisp? Not
> counting Scheme, did it exist in predecessors of Common Lisp? Was it
> used much? Is it really true that Common Lisp had both lexical and
> dynamic scope in order to support older code that was written relying
> on dynamic scope and was too hard to convert?

That question should be answered by someone from the standardizing
committee, but anyway I think that there's two questions here.

Dynamic scope is necessary for some things (e.g. mutable global
variables, the condition system, thread-local storage, etc.), and then
there is the general user-level facility for declaring special
variables. So it might very well be that the original motivations for
those are different...

--
Resistance is futile. You will be jazzimilated.

Jazz site: http://www.didierverna.com
Other sites: http://www.didierverna.info

Re: History of lexical scope in Lisp

<ut7mb5$3o0fg$3@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18104&group=comp.lang.lisp#18104

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sun, 17 Mar 2024 21:12:05 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <ut7mb5$3o0fg$3@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com>
<65f6baad$0$5286$426a74cc@news.free.fr>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 17 Mar 2024 21:12:05 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b5c3033c9cb89f318b807c840903d225";
logging-data="3932656"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Tw8AA27wbp3U8VwNTYvj7"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:tNlWb4K4WFdrvztIbByDhlOcONQ=
 by: Lawrence D'Oliv - Sun, 17 Mar 2024 21:12 UTC

On Sun, 17 Mar 2024 10:41:01 +0100, Didier Verna wrote:

> Dynamic scope is necessary for some things (e.g. mutable global
> variables, the condition system, thread-local storage, etc.) ...

Can’t see the reasoning behind any of those three examples. Thread-local
storage is the same as global variables, and global scope is just the
outermost lexical scope. As for the condition system, see my example
showing how a lexically-scoped language like Python can handle that.

Re: History of lexical scope in Lisp

<ut7rkt$3p750$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18105&group=comp.lang.lisp#18105

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jbb@notatt.com (Jeff Barnett)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sun, 17 Mar 2024 16:42:34 -0600
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <ut7rkt$3p750$1@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <ut2gnj$2g8k5$1@dont-email.me>
<ut2hvh$2gft8$1@dont-email.me> <ut3f7t$2p3sa$1@dont-email.me>
<ut3hlt$2pi20$1@dont-email.me> <ut5u5i$3c0e6$1@dont-email.me>
<ut5vjg$3c7pv$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 17 Mar 2024 22:42:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7253f92624daadea9204047ea55daaae";
logging-data="3972256"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GJNma7cocr6H6AdX0JUoYUQIyu+Z1ISE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:LzzEFgFDFBf7wr/BZY5cmN++fgU=
In-Reply-To: <ut5vjg$3c7pv$2@dont-email.me>
Content-Language: en-US
 by: Jeff Barnett - Sun, 17 Mar 2024 22:42 UTC

On 3/16/2024 11:37 PM, Lawrence D'Oliveiro wrote:
> On Sat, 16 Mar 2024 23:13:20 -0600, Jeff Barnett wrote:
>
>> However if your point is that you can build "simulations" of one sort of
>> scoping out of primitives for another sort ...
>
> No, my point was that there seems to be no need for dynamic scoping, if
> the only excuse anyone can come up for needing it comes out of exception
> handling.

That wasn't the only thing mentioned. In fact it was said to be quite
useful and desired without enumeration of reasons. You of course chopped
many original messages above to remove some of those "short glowing
reviews" then got on your hobby horse and started to ride.

Just think of the following when specifying a variable's intent: is it
supposed to influence an evaluation or is it supposed to influence an
evaluation when it's in a particular lexical scope? Does that help you any?

The example of error handling is that it's generally supposed to control
an evaluation. If error handling was lexically based then you would need
to decide what to do when evaluate(x) occurs and the handling of certain
conditions are specified in a scope not available when x was defined.
There are choices and lots of them. When dynamic and lexical flow trees
are different, you must decide by language rules or provide primitives
to users that allows them to sort out intent. If you don't have any
"special" variables around, you'll find that rather difficult.

Lexical-only is nice and neat for many applications and philosophies of
programming. But not all by a long shot. If that approach satisfies you,
I'd suggest ALGOL or even SIMULA. Alan Perlis even saw uses for dynamic
visibility (private communications) and discussed the thought that OWN
variables did not satisfy those uses. There was an ambiguity in the
second ALGOL spec on the requirements for OWN variables: if the spec was
read one way, a particular function computed a Legendre polynomial; read
the other way, it computed a Bessel function! (It's been a long time and
I don't remember the exact pair of function families that were
confounded.) In any event, the issue had to do for the rules about when
an OWN needed to be bound and it was possible to have multiple bindings
simultaneously! I believe this latter fact was tied up with trying to
allow OWNS to act more like SPECIAL.
--
Jeff Barnett

Re: History of lexical scope in Lisp

<ut7svi$3pbnh$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18106&group=comp.lang.lisp#18106

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Sun, 17 Mar 2024 23:05:22 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <ut7svi$3pbnh$2@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <ut2gnj$2g8k5$1@dont-email.me>
<ut2hvh$2gft8$1@dont-email.me> <ut3f7t$2p3sa$1@dont-email.me>
<ut3hlt$2pi20$1@dont-email.me> <ut5u5i$3c0e6$1@dont-email.me>
<ut5vjg$3c7pv$2@dont-email.me> <ut7rkt$3p750$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 17 Mar 2024 23:05:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1caa94953308d6b372e5a50b12554bf8";
logging-data="3976945"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DjI69xgbcIoyHrxLLAfkm"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:tZJRh/ppHUiIr6KM21kGDoXqJkw=
 by: Lawrence D'Oliv - Sun, 17 Mar 2024 23:05 UTC

On Sun, 17 Mar 2024 16:42:34 -0600, Jeff Barnett wrote:

> Just think of the following when specifying a variable's intent: is it
> supposed to influence an evaluation or is it supposed to influence an
> evaluation when it's in a particular lexical scope? Does that help you
> any?

Seems you phrased that wrong: it should be “is it supposed to influence an
evaluation or is it supposed to influence an evaluation when it’s in a
particular *dynamic* scope”? Because a variable in a lexical scope is
always in that lexical scope, no “when” about it.

> The example of error handling is that it's generally supposed to control
> an evaluation. If error handling was lexically based ...

I didn’t say error handling was lexically based, I said the matching of
exceptions was lexically based. I thought my example made that distinction
clear.

Re: History of lexical scope in Lisp

<nnd$79e8f550$72629b38@7ae82f9f1ca9b0e9>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18107&group=comp.lang.lisp#18107

  copy link   Newsgroups: comp.lang.lisp
Newsgroups: comp.lang.lisp
References: <874jd7z5nf.fsf@nightsong.com> <ut5u5i$3c0e6$1@dont-email.me> <ut5vjg$3c7pv$2@dont-email.me> <ut7rkt$3p750$1@dont-email.me>
From: albert@spenarnc.xs4all.nl
Subject: Re: History of lexical scope in Lisp
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$79e8f550$72629b38@7ae82f9f1ca9b0e9>
Organization: KPN B.V.
Date: Mon, 18 Mar 2024 14:47:29 +0100
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe006.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 17
Injection-Date: Mon, 18 Mar 2024 14:47:29 +0100
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1471
 by: albert@spenarnc.xs4all.nl - Mon, 18 Mar 2024 13:47 UTC

In article <ut7rkt$3p750$1@dont-email.me>,
Jeff Barnett <jbb@notatt.com> wrote:
>second ALGOL spec on the requirements for OWN variables: if the spec was

You can't refer to ALGOL like this. It is either ALGOL60 or ALGOL68.
These are totally different languages.
ALGOL60 is an early experiment. ALGOL68 is practically Google's go.

>--
>Jeff Barnett
>
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat purring. - the Wise from Antrim -

Re: History of lexical scope in Lisp

<uta5vv$bdg5$3@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18108&group=comp.lang.lisp#18108

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Mon, 18 Mar 2024 19:51:27 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <uta5vv$bdg5$3@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <ut5u5i$3c0e6$1@dont-email.me>
<ut5vjg$3c7pv$2@dont-email.me> <ut7rkt$3p750$1@dont-email.me>
<nnd$79e8f550$72629b38@7ae82f9f1ca9b0e9>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 18 Mar 2024 19:51:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1caa94953308d6b372e5a50b12554bf8";
logging-data="374277"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197q/PHLW84Wv37slXR4mnZ"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:2ujrqGGQrZo9SsrynBF1brewacg=
 by: Lawrence D'Oliv - Mon, 18 Mar 2024 19:51 UTC

On Mon, 18 Mar 2024 14:47:29 +0100, albert wrote:

> ALGOL60 is an early experiment.

Actually, the “early experiment” was IAL, a.k.a. ALGOL58.

And then there was “ALGOL-W”, a.k.a. “Wirth-Hoare ALGOL”, which was the
precursor to Pascal.

Re: History of lexical scope in Lisp

<bgehvi9elnkgo6qjchi1dvlks1du5tvo0s@4ax.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18109&group=comp.lang.lisp#18109

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!.POSTED!not-for-mail
From: gneuner2@comcast.net (George Neuner)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Mon, 18 Mar 2024 20:33:08 -0400
Organization: i2pn2 (i2pn.org)
Message-ID: <bgehvi9elnkgo6qjchi1dvlks1du5tvo0s@4ax.com>
References: <874jd7z5nf.fsf@nightsong.com> <ut5u5i$3c0e6$1@dont-email.me> <ut5vjg$3c7pv$2@dont-email.me> <ut7rkt$3p750$1@dont-email.me> <nnd$79e8f550$72629b38@7ae82f9f1ca9b0e9>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: i2pn2.org;
logging-data="2459718"; mail-complaints-to="usenet@i2pn2.org";
posting-account="h5eMH71iFfocGZucc+SnA0y5I+72/ecoTCcIjMd3Uww";
User-Agent: ForteAgent/8.00.32.1272
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: George Neuner - Tue, 19 Mar 2024 00:33 UTC

On Mon, 18 Mar 2024 14:47:29 +0100, albert@spenarnc.xs4all.nl wrote:

>In article <ut7rkt$3p750$1@dont-email.me>,
>Jeff Barnett <jbb@notatt.com> wrote:
>>second ALGOL spec on the requirements for OWN variables: if the spec was
>
>You can't refer to ALGOL like this. It is either ALGOL60 or ALGOL68.
>These are totally different languages.
>ALGOL60 is an early experiment. ALGOL68 is practically Google's go.

FWIW: ALGOL68 was described by two different reports using completely
different grammar notation.

[1] Report on the Algorithmic Language ALGOL 68
[2] Revised Report on the Algorithmic Language ALGOL 68

The original report used a "Van Wijngaarden" (vW) grammar. vW grammars
are 2-level, consisting of a conventional attribute grammar, augmented
by a "meta" grammar which describes the possible values of attributes
in the 1st grammar. In theory, a vW grammar can do wonderful things
such as turn type errors into syntax errors.

Unfortunately, vW grammars are Turing Complete - programming languages
in themselves. The grammar in the ALGOL 68 report widely was
considered to be too difficult for many compiler implementors to
understand.

Thus the report was rewritten using an adhoc notation called "NEST"
[which AFAICT was never used again]. NEST also was 2-level and able to
describe attribute values, but more verbose than vW, and deliberately
made not Turing Complete.

However, the grammars in the two reports are so different that they
are difficult to compare, and there was/is some debate as to whether
they truly describe the same language. In any event, almost all
AlGOL68 compilers were said to have been developed using the revised
report.

[1]
https://pdfroom.com/books/report-on-the-algorithmic-language-algol-68/Jr2ELK1agyv
[2]
https://www.softwarepreservation.org/projects/ALGOL/report/Algol68_revised_report-AB-600dpi.pdf

Re: History of lexical scope in Lisp

<utb691$leks$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18110&group=comp.lang.lisp#18110

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jbb@notatt.com (Jeff Barnett)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Mon, 18 Mar 2024 23:02:23 -0600
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <utb691$leks$1@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <ut2gnj$2g8k5$1@dont-email.me>
<ut2hvh$2gft8$1@dont-email.me> <ut3f7t$2p3sa$1@dont-email.me>
<ut3hlt$2pi20$1@dont-email.me> <ut5u5i$3c0e6$1@dont-email.me>
<ut5vjg$3c7pv$2@dont-email.me> <ut7rkt$3p750$1@dont-email.me>
<ut7svi$3pbnh$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64
Injection-Date: Tue, 19 Mar 2024 05:02:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a78f588840fadcc0c8b63bd5cb45ec84";
logging-data="703132"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ckJITbEguzjSJXLO/x2KFDJjaWebe+LU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:4DGzIUXUbw1eiibUwzP/RUX5Nu8=
Content-Language: en-US
In-Reply-To: <ut7svi$3pbnh$2@dont-email.me>
 by: Jeff Barnett - Tue, 19 Mar 2024 05:02 UTC

On 3/17/2024 5:05 PM, Lawrence D'Oliveiro wrote:
> On Sun, 17 Mar 2024 16:42:34 -0600, Jeff Barnett wrote:
>
>> Just think of the following when specifying a variable's intent: is it
>> supposed to influence an evaluation or is it supposed to influence an
>> evaluation when it's in a particular lexical scope? Does that help you
>> any?
>
> Seems you phrased that wrong: it should be “is it supposed to influence an
> evaluation or is it supposed to influence an evaluation when it’s in a
> particular *dynamic* scope”? Because a variable in a lexical scope is
> always in that lexical scope, no “when” about it.
Given the sort of languages we are talking about (e.g., not CRISP
described above) you really can't escape from one dynamic scope to
another. You need coroutines that have no start/restart commitments to
one another.
>> The example of error handling is that it's generally supposed to control
>> an evaluation. If error handling was lexically based ...
>
> I didn’t say error handling was lexically based, I said the matching of
> exceptions was lexically based. I thought my example made that distinction
> clear.
Maybe it did but not to me.
--
Jeff Barnett

Re: History of lexical scope in Lisp

<utb8on$lttb$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18111&group=comp.lang.lisp#18111

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Tue, 19 Mar 2024 05:44:55 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <utb8on$lttb$1@dont-email.me>
References: <874jd7z5nf.fsf@nightsong.com> <ut2gnj$2g8k5$1@dont-email.me>
<ut2hvh$2gft8$1@dont-email.me> <ut3f7t$2p3sa$1@dont-email.me>
<ut3hlt$2pi20$1@dont-email.me> <ut5u5i$3c0e6$1@dont-email.me>
<ut5vjg$3c7pv$2@dont-email.me> <ut7rkt$3p750$1@dont-email.me>
<ut7svi$3pbnh$2@dont-email.me> <utb691$leks$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 19 Mar 2024 05:44:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="cf2257effda993e7401c0124f815988b";
logging-data="718763"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX191WjTUxFKWJD8VjxdVzajF"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:0C/sKc5b9lsafHbdAm0urRvTmaQ=
 by: Lawrence D'Oliv - Tue, 19 Mar 2024 05:44 UTC

On Mon, 18 Mar 2024 23:02:23 -0600, Jeff Barnett wrote:

> ... you really can't escape from one dynamic scope to
> another.

Au contraire, with dynamic scoping, such “escaping” happens all the time.

Here’s an example from a language, namely Perl, which does allow for
dynamic scoping (in fact, early on it had no lexical scoping):

$a = 1;

sub f1()
{
$a = $a + 1;
} # f1

sub f2()
{
local $a = 3;
print "inner ", $a, "\n";
f1();
print "inner ", $a, "\n";
} # f2

f1();
print "outer ", $a, "\n";
f2();
print "outer ", $a, "\n";
f1();
print "outer ", $a, "\n";

The output is

outer 2
inner 3
inner 4
outer 2
outer 3

>> I didn’t say error handling was lexically based, I said the matching of
>> exceptions was lexically based. I thought my example made that
>> distinction clear.
>
> Maybe it did but not to me.

Look back again, and see how the outer exception is not the same as the
one with the same name local to the function, yet the catch clauses search
for the exceptions according to dynamic execution nesting.

Want me to go over it step-by-step?

Re: History of lexical scope in Lisp

<87sf0mh9oj.fsf@tudado.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=18112&group=comp.lang.lisp#18112

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jfairchild@tudado.org (Johanne Fairchild)
Newsgroups: comp.lang.lisp
Subject: Re: History of lexical scope in Lisp
Date: Tue, 19 Mar 2024 06:07:08 -0300
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <87sf0mh9oj.fsf@tudado.org>
References: <874jd7z5nf.fsf@nightsong.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="7aff4695c44eee6d3b97efe88388cf90";
logging-data="792812"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18zWOPj+N4zsCF6xBzT47DJ0HCfgbSecs8="
Cancel-Lock: sha1:/0oD3dQJXWMtnOhs4vw5DcKePts=
sha1:4FBzEYTM/cfVSI+5IkKXmooxK0o=
 by: Johanne Fairchild - Tue, 19 Mar 2024 09:07 UTC

Paul Rubin <no.email@nospam.invalid> writes:

> Does anyone know when lexical scope started appearing in Lisp?

You should find some information in

Steele, Guy L., and Richard P. Gabriel. "The evolution of Lisp."
History of programming languages---II. 1996. 233-330.
https://dl.acm.org/doi/pdf/10.1145/234286.1057818

For instance:

--8<---------------cut here---------------start------------->8---
When the IBM 370 came out, Lisp370 implementation began. [...]

Lisp370 supported both special binding and lexical binding, as well as
closures over both lexical and special variables, using a technique
similar to spaghetti stacks. (Page 31.)
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
Scheme was one of the first languages to have taken seriously the
implications of lexical scoping (as opposed to local scoping, which
had been in use in Lisp compilers for almost a decade) and first-class
functions. (Page 23.)
--8<---------------cut here---------------end--------------->8---

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor