[e-lang] "Scope" or "Environment"? Your observations wanted
Lex Spoon
lex at lexspoon.org
Mon Aug 11 17:16:57 CDT 2008
On Aug 10, 2008, at 8:25 PM, Kevin Reid wrote:
> I've been arguing (to MarkM) that the thing which E-on-Java calls
> Scope should be called Environment, or Env.
>
> What is now called Scope is a collection of nouns (variable names)
> associated with slots providing the values for those nouns.
I think of a scope as a subset of the program where, well, some
environment is available. :) The same environment might well apply
to multiple scopes.
>
> I have said that a "scope" actually refers to the textual region in
> which a variable is visible; i.e. it is static, and a property of the
> program, whereas "environment" refers to the runtime state, what the
> variables in some scope are bound to in the execution under
> consideration.
That sounds good except that it's also fine to talk about a static
environment. A static environment gives what is known at compile
time about, well, a run-time environment. It typically includes a
list of available variable names, along with their types if the
language is statically typed. In general an environment can include
all sorts of stuff, not just variables, but variables are the most
common thing.
Environments are closely related to the ambient authority that caps
folks talk about. The variables in an environment are those you can
access without any qualification; you can just write down their
name. The variables in a static environment are those you can
*predictably* access by just writing down their name.
-Lex
More information about the e-lang
mailing list