Scope

A scope is a syntactic unit of locality.

It offers boundaries for modules. If these boundaries are explicitly declared, they may be checked. This explicit declaration is what typing is all about. The existence of scopes allows for a synthesis between polymorphism and static typing. This gives us some control on dependencies, and thus decoupling between client and server code.

In procedural languages, as C, the only named scopes were functions. C++ has extended this concept to class scopes.

A function call encapsulates two messages (initiation and completion) and a scope. The scope is usually hidden. It encompasses the actual transition from the before to the after state.

The actual state transition is hidden, so that it may be defined in different ways, without invalidating any client code.

If the function is specified in the client context, it is binding for implementations, and thus works as a behaviour specification, in a practical partial (abstract) way, without the burden of formal specification languages.

With distribution, function scopes break down. For them to make sense again, they must be promoted into full temporal scopes.

Table of contents


Marc Girod
Last modified: Sat Feb 28 14:27:08 EET 1998