Flow of Data and Control Full


 

  • Yielder ::= Data | DataOp | DataOp Yielder | (Yielder , . . . , Yielder)
  • Enquirer ::= DataPred | DataPred Yielder
  • Action ::= give Yielder | Action Yielder | given Yielder | when Enquirer | skip | err | tentatively Action | infallibly Action

  Data operations occurring in yielders are applied either to the current given data, or to explicit yielder arguments. For instance, the yielder the s refers to the given data, and projects it onto the subsort s, thus corresponding to given s in AN­1. The compound yielder the s Y in AN­2 corresponds to the AN­1 yielder the s yielded by Y, so in particular, the s#i projects the i th component of the data onto the subsort s, and corresponds to given s#i in AN­1. All components of a tuple yielder (Y 1, . . . , Yn) are required to yield elements of Datum.

  As may be expected, the action give Y gives the data yielded by Y. The action A Y merely abbreviates give Y then A. Typically, A here will be a simple action (such as update, inspect, or raise) that expects to be given certain data, and Y will be a yielder that computes the expected data. An example is update (the cell#2 , the storable#1). If the expected data is already available, the insertion of Y may still be useful for emphasis (or for fluency of reading), as in inspect the cell . Notice that the compound action raise Y expresses the same as the AN­1 action escape with Y.

  In AN­2, given Y is an action, and intended for use as a guard. When the given data is identical to the data yielded by Y, it simply copies the given data, but otherwise it fails. Thus given d tests that the given data is the same as d, and given an s tests that the given data is in the subsort represented by s.

  An enquirer is a generalization of data predicates to allow their composition with yielders. The action when Q checks whether the enquirer Q holds or not, copying the arguments of the predicate if it does, but failing otherwise.

  The remaining actions are all rather trivial: skip abbreviates provide(); err abbreviates provide() then raise; tentatively A fails whenever A terminates exceptionally with no data, and vice versa for infallibly A.



   
Data| Actions as Data| Effects on Storage| Scopes of Bindings| Interactive Processes