Namespaces
Heta uses simple not-nested spaces of names.
A platform include one default namespace
namelessand any number of user defined namespaces.If space is not set than the component refers to
nameless(default) namespace.Space and id form index of a component which is the coordinate of component in platform. A component in space
onewith idp1has indexone::p1. A component innamelessspace and idk1have and indexk1which is the same asnameless::k1.Namespaces is intended for:
- storing several independent models in one platform;
- re-using model components;
- There are two ways to work with namespaces: using
namespacestatement and without it.
Example: Working with namespace statement. This code creates the simple model in a created namespace "one".
namespace one begin
comp1 @Compartment .= 1.1;
x1 @Species { compartment: comp1 } .= 10;
x2 @Species { compartment: comp1 } .= 0;
r1 @Reaction { actors: x1 => x2 } := k1*x1*comp1;
k1 @Const = 1.1;
endThis code is equivalent to the following code without namespace statement.
#setNS { space: one };
one::comp1 @Compartment .= 1.1;
one::x1 @Species { compartment: comp1 } .= 10;
one::x2 @Species { compartment: comp1 } .= 0;
one::r1 @Reaction { actors: x1 => x2 } := k1*x1*comp1;
one::k1 @Const = 1.1;- There are two types of namespaces:
abstractandconcrete. The default namespace isconcreteif not set in#setNSornamespacestatement. Ifabstractnamespace is set then checking and binding references is skipped in compilation.
Example 1: Setting concrete namespace using namespace statement.
concrete namespace new begin // the same as "namespace new begin"
rule1 @Record := x*y;
endCreating concrete namespace using #setNS
#setNS { type: concrete, space: new }; // the same as "#setNS new::*;"
new::rule1 @Record := x*y;Example 2: Setting abstract namespace using namespace statement.
abstract namespace new begin
rule1 @Record := x*y;
endCreating abstract namespace using #setNS
#setNS { type: abstract, space: new };
new::rule1 @Record := x*y;