Path: ...!weretis.net!feeder6.news.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 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: References: <874jd7z5nf.fsf@nightsong.com> 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= Bytes: 2767 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.