This is an old revision of the document!


Assertions

Sometimes parameterized components are only valid for certain parameter ranges. ACT includes assertions that are checked at expansion time that can be used to validate the assumptions made.

As a simple example, suppose we want to define an N-place buffer.

template<pint N>
defproc buffer(chan?(int) L; chan!(int) R)
{
    onebuf b[N];   // create one-place buffer elements
    (i:N-1: b[i+1].L = b[i].R;)  // connect internal channels
    b[0].L = L; // connect external input
    b[N-1].R = R; // connect external output
}