Channels, Processes etc.

home1 home2
and the

Channels and processes etc. are first class values, so they can be computed, passed as parameters, and passed down channels, of course.
A single input- or output-action is arguably not a value as such, in particular an input-action, such as inch?x, needs a continuation, c, if anything useful is to be done with the value input to the variable x. I.e. (λ cont.inch?x -> cont x) will do, and the λ-expression is a value.
In the following artificial example,
outputB is an action (in the sense above) to output 'B' on a fixed channel, here output, and then continues with outContinuation.
outputX uses a fixed channel, output again, but is parameterised on the value, X.
inputX is an input action, with continuation inContinuation which uses the value that is input.
The sender gives these actions to the receiver which makes use of them.
The HTML form below can be used to run the example.
let ch=chan in let

 receiver =
   ch?chnl -> chnl!'A' ->                    {get & use a channel}
   ch?outAction ->                           {get an output action}
   outAction (                               {& do the output act }
              ch?outX ->                     {get an output action}
              outX 'C' (                     {& do it             }
                        ch?inAction ->           {get input action}
                        inAction (               {& do it         }
                                  lambda z.output!z ->  {& use val}

 sender =
  let outputB = {an output action, both channel and msg fixed}
        lambda outContinuation. output!'B' -> outContinuation,

      outputX = {an output action, only channel fixed}
        lambda X. lambda outContinuation.
          output!X -> outContinuation,

      inputX  = {an input  action, channel fixed}
        lambda inContinuation. ch?X -> inContinuation X

  in ch!output -> ch!outputB -> ch!outputX ->
     ch!inputX -> ch!'D' -> stop

in sender || receiver

{\fB Pass Input and Output Actions along (untyped) Channel. \fP}

e.g. c1993

Coding Ockham's Razor, L. Allison, Springer

A Practical Introduction to Denotational Semantics, L. Allison, CUP

free op. sys.
free office suite
~ free photoshop
web browser

|   choice
|| parallel
-> sequence
? input act
! output act
chan new channel

© L. Allison   (or as otherwise indicated),
Faculty of Information Technology (Clayton), Monash University, Australia 3800 (6/'05 was School of Computer Science and Software Engineering, Fac. Info. Tech., Monash University,
was Department of Computer Science, Fac. Comp. & Info. Tech., '89 was Department of Computer Science, Fac. Sci., '68-'71 was Department of Information Science, Fac. Sci.)
Created with "vi (Linux + Solaris)",  charset=iso-8859-1,  fetched Wednesday, 08-Feb-2023 10:52:30 AEDT.