Go to the Next or Previous section, the Detailed Contents, or the FS(E)L Home Page.


A.3.4 Channels

Syntax

channel flip, flop simple channels
channel c, d : {0..3}.LEVEL channels with more complex protocol
Events the type of all defined events

Remarks

Channels are tags which form the basis for events. A channel becomes an event when enough values have been supplied to complete it (for example flop above is an event). In the same way that, given

datatype T = A.{0..3} | ...

we know that A.1 is a value of type T, given

channel c : {0..3}

we know that c.1 is a value of type Event. Indeed, the channel definitions in a script can be regarded as a distributed definition for the built-in Events datatype.

Channels must also be rectangular in the same sense as used for datatypes. It is common in FDR2 to make channels finite although it is possible to declare infinite channels and use only a finite proportion of them.

Channels interact naturally with datatypes to give the functionality provided by variant channels in occam2 (and channels of variants in occam3). For example, given ComplexColour as above, we can write a process which strips out the redundant colour encodings (undoing the work performed by make_colour)

channel colour : ComplexColour
channel standard : Gun.Gun.Gun

Standardise =
    colour.RGB?x -> standard!x -> Standardise
  []
    colour.Grey?x -> standard!x.x.x -> Standardise
  []
    colour.Black -> standard!0.0.0 -> Standardise
  []
    colour.White -> standard!15.15.15 -> Standardise


Go to the Next or Previous section, the Detailed Contents, or the FS(E)L Home Page.