During the compilation, each scope inside a program corresponds to an environment. During the declaration phase, the environment is filled up with declarations of variables, functions, converters, types and modules. During the actual compilation, the environments do no longer change, except for the “environment cache” for frequent computations (e.g. inferred conversions or function applications). Classes and modules naturally come with their environments, part of which may be public and imported into other environments.

There are several types of environments:

Global environment

This is the top-level environment.

Lambda environment

This is a local environment which is used during the compilation of local bodies and in particular bodies of lambda expressions. More precisely, the primitives which use use lambda environments are lambda, map, begin, loop and where.

Method environment

This is a special environment with macros for simplied method access. More precisely, any class field x or method foo can be accessed simply by x or foo inside the method environment instead of this.x or this.foo.

Class environment

This is a local environment with all declarations relative to a class. Part of the declarations may be declared public, so as to be visible in the parent environment.

Module environment

This is similar to class environments, except that modules do not support intern class fields and that public declarations are not automatically exported to the parent environment.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License. If you don't have this file, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.