CHP Value References - The HAC Language
Description: The HAC Language

Next: CHP Operators, Up: CHP Expressions

#### 14.1.1 Value References

CHP describes the computation and communication of data variables over channels. Since CHP describes the run-time behavior of programs, the values referenced are only resolved at run-time, just like in a traditional C program. The data-types referenced may `bool`, `int`, enums, or user-defined (structs) (Datatypes).

The indices used to address values may themselves be run-time variables. For example, in `x[i]`, `i` may be an `int` received over a channel. Operationally, this means we need run-time array bounds checks on indices, and existence checks in the case of sparse arrays.

In CHP, `pint` s are considered `int``<32>` values and `pbool` s are considered `bool` values as far as type-checking is concerned. (Proposal: support for wildcard (automatic) widths when interpreting `pint` as `int`.)

Note: the current implementation does not yet support ranged references (`x[i..j]`). We don't expect this to be difficult, but implementation will be deferred until this feature is warranted.

UPDATE: nonmeta languages, including CHP, no longer support aggregate instance or value references. This means meta-valued ranges cannot appear in any nonmeta language. Nor can implicit non-scalar collection references appear in nonmeta language. Simply put, all references in nonmeta languages must be scalar (0-dimensional).

Arbitrarily complex indexed and member references are supported in the nonmeta languages, such as CHP. However, it is up to the downstream toolchain to interpret or impose further restrictions on the references. For example, a reference such as `x[pi][j].y[k]`, where `pi` is a meta-valued index and `j` and `k` are nonmeta valued integers could lead to a very difficult synthesis or analysis.