OEP

104

Title

Channel direction specifiers

Summary

Allow ? and ! markers on channel parameters to indicate direction.

Owner

Fred Barnes <F.R.M.Barnes@kent.ac.uk>

Status

Accepted

Date-Accepted

2001-10-23

Keywords

language channels parameters

The direction of communication on channel parameters to PROCs can now be specified in their formal and actual parameters. The compiler will bear this in mind when checking the channel usage inside a PROC. It also adds more information to a PROCs interface from the code perspective. For example:

PROC foo (CHAN INT in?, out!, CHAN BOOL terminate?)
  ...
:

and:

CHAN INT c:
PAR
  foo (c?, ...)
  other (c!)

The usage of this also applies to channel abbreviations, for example:

PROC foo.2 ([8]CHAN INT64 in?, CHAN INT64 out!)
  ...
  CHAN INT r? IS in[i]?:
  ...
:

the compiler will check that output channels are not abbreviated as input channels and visa-versa.

In strict mode (using the "-s" flag to kroc), usage of channel-direction specifiers is enforced.

When referring to array slices, the direction specifier should go inside with the array, eg:

PROC thing ([]CHAN INT in?)
  []CHAN INT i? IS [in? FROM 2]:
  ...
:

OEP/104 (last edited 2007-09-27 00:02:51 by ats1)