OEP

154

Title

Protocol item names

Summary

Allow item names to be specified in protocol definitions.

Owner

Adam Sampson

Status

Proposed

Date-Proposed

2006-04-23

Keywords

language protocols occamdoc

occam-pi protocol definitions currently do not name the items in the protocol:

PROTOCOL UPDATE IS INT; INT; BYTE:

This makes it hard to tell from the protocol definition what the items are actually used for, so programmers typically write a comment above the protocol giving that information:

-- x; y; character
PROTOCOL UPDATE IS INT; INT; BYTE:

For the purposes of occamDoc, this makes protocol declarations awkward, since the items must be documented in order without names; the occamDoc syntax for protocols must therefore be different from that for records. Compiler error messages about protocols also have to use item numbers:

test.occ(4)- I/O list item 3 does not match protocol

Instead, I would suggest allowing programmers to give names to their items:

PROTOCOL UPDATE IS INT x; INT y; BYTE char:

These can be safely ignored by the compiler for the purposes of code generation, but make the code more self-documenting, can be referenced in occamDoc protocol definitions, and could in the future be used to provide slightly more helpful error messages:

test.occ(4)- I/O list item 'char' does not match protocol

OEP/154 (last edited 2007-09-27 01:30:21 by ats1)