Static values are infinite constant streams made of a value and they
are introduced with the construction
let static. Static values
are usefull to define parameterised systems. For example:
let static m = 100.0 let static g = 9.81 let static mg = m *. g val mg : float val mg :: static
A static value is distinguished from the other by its clock: the clock static means that the value can be computed once for all at instantiation time, before the execution starts.
It is possible to impose that the input of a function be a static value. For example:
let node integr (static dt) x0 dx = x where rec x = x0 -> pre x +. dx *. dt val integr : float -> float => float val integr :: static -> ’a -> ’a
The definition of a static value is valid if the right-hand part of the definition is a constant stream. In the present version of the compiler, a stream is said to be constant when it is both combinatorial and its clock can be fully generalized.
A static expression is thus not necessarily an immediate constant. It can be any combinatorial expression which only depend on other static expressions. This is why the following program is rejected:
let node wrong x0 dt = integr (0.0 -> 1.0) x0 dt File "tutorial.ls", line 15, characters 10-20: > integr (0.0 -> 1.0) x0 dt > ^^^^^^^^^^ This expression has clock ’b, but is used with clock static.