This is an old revision of the document!


Connections

When two nodes are connected to each other by wires, they effectively become one electrical node. This connection operation is part of the ACT language, and is denoted by the = sign. The = operation is also overloaded for meta-language variables to denote assignment. Multiple connections can be specified in a single statement by repeatedly using the = operator. This section describes the different connection statements supported by ACT.

Simple connections

The simplest possible connection statement is the connection of two variables of type bool.

bool x, y;
x=y;

The effect of this operation is to alias the two nodes. After this operation is performed, both x and y refer to the same value. Meta-language types can also be 'connected' to expressions. The result of such a 'connection' is that the right hand side of the = sign is evaluated, and assigned to the variable on the left. Such connections are only meant to initialize the values of parameters.

pint x, y;
x=5;
y=x*1+2;         // success

Whereas connecting nodes is a symmetric operation, connecting meta-language variables is not symmetric, as illustrated below.

pint x, y;
x=5;
x=y*1+2;
-[ERROR]-> id: y
           FATAL: Uninitialized identifier

Meta-language parameter connections correspond to assignment statements. ACT permits assigning floating-point values to integer-valued variables, and vice versa. However, there are some restrictions on meta-language variable assignments.

pint x;
x=5;
x=8;
-[ERROR]-> Id: x
           FATAL: Setting immutable parameter that has already been set

In this example, x has been declared and then defined twice at the top-level of the ACT file. This makes x a global variable, which means x can be used in types defined later in the ACT file. This potentially makes x an implicit parameter for all types, even though x does not appear in the template parameter list for any of them. To prevent the situation where x might have different values depending on when a type is used, global parameters can only be defined once in ACT. This constraint also applies to template parameters for the same reason.

However, for parameters defined within the body of a type, they can be defined multiple types since they are not in the scope of any other type. ACT defines global parameter variables and template parameter variables as immutable types—they can only be defined once.