From: William Wong
Subject: Catch/Throw in load file
Date: 
Message-ID: <1991May18.003253.4124@ashtate>
I got a question about Catch and Throw with loading file.  Let's say I
install a (Catch 'Name1) in a function, and later, does a (load "file1") 
in the same function.  Now if I do a (Throw 'Name1) in "file1," where
does the control flow go?  Does it go back to (Catch 'Name1)?  Or does it
say "couldn't find Name1"?

In CLtL2, it says Catch/Throw have no scope.  I am wondering whether Load
is considered the same as the function in terms of lexical scope.


William
From: Barry Margolin
Subject: Re: Catch/Throw in load file
Date: 
Message-ID: <1991May18.043348.8907@Think.COM>
In article <·····················@ashtate> ·······@ashtate.UUCP (William Wong) writes:
>I got a question about Catch and Throw with loading file.  Let's say I
>install a (Catch 'Name1) in a function, and later, does a (load "file1") 
>in the same function.  Now if I do a (Throw 'Name1) in "file1," where
>does the control flow go?  Does it go back to (Catch 'Name1)?  Or does it
>say "couldn't find Name1"?

It returns from the CATCH.  Any THROW that occurs during the dynamic extent
of a matching CATCH will return from the CATCH.

>In CLtL2, it says Catch/Throw have no scope.  I am wondering whether Load
>is considered the same as the function in terms of lexical scope.

I'm not sure how to interpret this question, or what its relevance is.  You
just said, correctly, that CATCH tags aren't lexically scoped, so why does
it matter which lexical scope the file is in?

But to clarify, lexical scope, by definition, is not dependent upon runtime
invocation order.  Every top-level form in a file being loaded defines its
own lexical scope, which only includes the forms textually visible within
that top-level form.  Since the contents of a different file are not
textually enclosed within the form containing the LOAD call, they are not
in the same lexical scope.  Lexical scope is a purely static, syntactic
property of a program.
-- 
Barry Margolin, Thinking Machines Corp.

······@think.com
{uunet,harvard}!think!barmar