OEP

174

Title

CLAIM AS

Summary

Add a syntax for abbreviation-like CLAIMs

Owner

Neil Brown <nccb2@kent.ac.uk>

Status

Proposed

Date-Proposed

2009-03-23

Keywords

shared channels

Shared channels can be declared thus:

  SHARED CHAN INT c:

And then claimed:

  CLAIM c!
    c ! 3

However, with arrays it gets a bit uglier:

  [10]SHARED CHAN INT cs:

  CLAIM c[0]
    SEQ
      c[0] ! 3
      VAL INT i IS 0:
      c[i] ! 5

Things like that are going to be a pain to check. Allowed a CLAIM AS syntax would make the code clearer:

  CLAIM c[0] AS cc
    SEQ
      cc ! 3
      cc ! 5

Standard abbreviation rules apply (you can't use c[0] in the scope of cc), and it becomes easy to type-check cc. It also means that we can consider the previous:

  CLAIM c!
    c ! 3

to be:

  CLAIM c! AS c
    c ! 3

Which I think works out nicely.

Edit: A syntax that does not introduce a keyword would involve IS:

  CLAIM cc IS c[0]
    SEQ
      cc ! 3
      cc ! 5

OEP/174 (last edited 2009-03-25 18:04:21 by nccb2)