A 'context' is a collection of values that can be accessed by functions.
Contexts come in five flavors: (this is still somewhat preliminary).
-
persistent context
-
lives forever
-
not nested
-
shared by all executions of the program
-
accessed by /<name> (root relative) or %<name> (cwd relative)
-
global context
-
lives throughout the execution of the program
-
may be nested
-
use of overridden values determined statically based on the placement of
the function body
-
shared by all executions of the function body
-
accessed by $<field_name>
-
class context
-
pointed to by 'self' object for member functions
-
may be nested through inheritance.
-
use of overridden values determined dynamically based on the class inheriting
the function body
-
shared by all executions of member functions for all objects instantiated
from this class
-
accessed by self.<field_name>
-
object context ('self' object for member functions)
-
'self' object for member functions
-
not nested
-
shared by all executions of member functions for this object
-
accessed by self.<field_name>
-
function context (which can be nested arbitrarily deeply)
-
temporary values for one execution of a function
-
may be nested (nested functions)
-
use of overridden values determined statically based on the placement of
the function body
-
shared by all nested functions
-
accessed by <field_name>