-
Heta uses simple not-nested spaces of names.
-
A platform include one default namespace
nameless
and 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
one
with idp1
has indexone::p1
. A component innameless
space and idk1
have and indexk1
which 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
namespace
statement 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;
end
This 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:
abstract
andconcrete
. The default namespace isconcrete
if not set in#setNS
ornamespace
statement. Ifabstract
namespace 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;
end
Creating 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;
end
Creating abstract namespace using #setNS
#setNS { type: abstract, space: new };
new::rule1 @Record := x*y;