Up: Definitions


3.1 Ports

In CAST, port declarations were allowed to be sparse, whereas in HAC, only dense declarations are allowed.

The following CAST definitions were legal:

define foo()(node x[1..3]) { }
define bar()(node x[0..2]) { }

However, in HAC, there is no equivalent to declaring port instances that start with non-zero indices. Note, that in CAST, the first set of parentheses in each definition are reserved for template parameterization. Thus, the above definition of foo cannot be expressed in HAC, whereas the definition of bar could be rewritten:

defproc bar(bool x[3]) { }

For more on dense and sparse arrays and their declarations, See Arrays. Templates describes how to generalize definitions using template parameters.