Whiley / RFCs

Request for Comment (RFC) proposals for substantial changes to the Whiley language.
3 stars 2 forks source link

Syntax for Framing #82

Closed DavePearce closed 3 years ago

DavePearce commented 4 years ago

(see also #39 and #38)

Currently, there is no mechanism for framing in Whiley. That is describing what locations can be modified. There are several different approaches here:

Papers

  1. Implicit Dynamic Frames, TOPLAS'12 [PDF]
  2. Implicit Dynamic Frames: Combining Dynamic Frames and Separation Logic, ECOOP'09. [PDF]
  3. The Relationship between Implicit Dynamic Frames and Separation Logic, LMCS'12 [PDF]
DavePearce commented 3 years ago

@utting this is as far as I’ve got thinking about thia...

DavePearce commented 3 years ago

One thing that is apparent to me (and mentioned in the TOPLAS paper above), is that you can infer framing from a method's specification. For example, consider this (using syntax from RFC#84:

method swap(&int x, &int y)
ensures *x == 'y && *y == 'x:
    ...

In particular, an occurrence of *x in the post-condition implies that it must be read, whilst an occurrence of 'x implies it must be written. In this way we can infer a suitable framing condition for swap(). However, in general, we will want implementations to be hidden and, hence, a given specification will not necessarily indicate all locations that are modified.