Deutsch   English   Français   Italiano  
<utb8on$lttb$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
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=
Bytes: 2469

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?