www.delorie.com/gnu/docs/smalltalk/gst_11.html   search  
Buy GNU books!

GNU Smalltalk User's Guide

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.2 Concepts

To support polymorphic symbolical identification several environments will be needed. The same name may be located concurrently in several environments and point to diverse objects.

However, symbolic navigation between these environments is needed. Before approaching the problem of the syntax to be implemented and of its very implementation, we have to point out which structural relations are going to be established between environments.

Since the environment has first to be symbolically identified to gain access to its global variables, it has to be a global variable in another environment. Obviously, Smalltalk will be the first environment from which the navigation begins. From Smalltalk some of the existing environments may be seen. From these environments other sub-environments may be seen, etc. This means that environments represent nodes in a graph where symbolic identifications from one environment to another one represent branches.

However, the symbolic identification should be unambiguous although it will be polymorphic. This is why we should avoid cycles in the environment graph. Cycles in the graph could cause also other problems in the implementation, e.g. unability to use recursive algorithms. This is why in general the environments build a directed acyclic graph(3).

Let us call the partial ordering relation which occurs between the two environments to be inheritance. Sub-environments inherits from their super-environments.

Not only that "inheritance" is the standard term for the partial ordering relation in the lattice theory but the feature of inheritance in the meaning of object-orientation is associated with this relation. This means that all associations of the super-environment are valid also in its sub-environments unless they are locally redefined in the sub-environment.

A super-environment includes all its sub-enviroments as associations under their names. The sub-environment includes its super-environment under the symbol #Super. Most environments inherit from Smalltalk, the standard root environment, but they are not required to do so; this is similar to how most classes derive from Object, yet one can derive a class directly from nil. Since they all inherit from Smalltalk all global variables defined in it, it is not necessary to define a special global variable pointing to root in each environment.

The inheritance links to the super-environments are used in the lookup for a potentially inherited global variable. This includes lookups by a compiler searching for a variable and lookups via methods such as #at: and #includesKey:.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003