next up previous
Next: 3 Method Invocation Up: CLANGER : an interpreted Previous: 1 Background

2 Variables in CLANGER

All variable names in CLANGER are Nemesis pathnames, and all values are Anys. An instance of the interpreter is associated with a root naming context. This context is used to resolve any variable name. It is also the context in which a new name is bound when a variable is encountered for the first time. New variables are created simply by assigning to them, and their type is inferred from the type of the value they receive. Since variables are nothing more than entries in some naming Context, any value in any name space reachable by a pathname from the interpreter's root is a CLANGER variable.

For manipulating instances of MIDDL's concrete types (integers, records, etc.) CLANGER has a full set of operators modelled on C and providing essentially the same functionality. Since each variable carries its own type around with it as part of its value, any operation on a concrete type can be typechecked at invocation time.

Similarly, a CLANGER value which is a pointer to an interface closure (also known as an interface reference) can have any valid method invoked on it (see section 3 below).

This embedding of the command language within the operating system's linkage structures gives the language its expressiveness and power. It also results in a very simple base language. For instance, unlike many embedded interpreters, CLANGER does not provide an associative array type. There are plenty of these in the operating system, indeed the most commonly used one is Context, which is the very mechanism used for variable binding anyway. Using associative arrays in CLANGER is just like using any other part of the operating system.

This also permits an interpreter to be embedded in almost any application with next to no effort--certainly without the need for the ad-hoc C wrappers required for languages such as Python [11] or Tcl [5]. Furthermore, when a new type is introduced to the system, CLANGER will be able to manipulate its values with no new code whatsoever.


next up previous
Next: 3 Method Invocation Up: CLANGER : an interpreted Previous: 1 Background

T. Roscoe