Concurrency with a type system that keeps its promises.
CaMPL is a typed, functional-style concurrent language where processes communicate by passing messages on channels. Its semantics come from the categorical theory of message passing — and pure programs are deadlock- and livelock-free.
coprotocol S => Console =
ConsolePut :: S => Get( [Char] | S )
ConsoleClose :: S => TopBot
proc helloworld :: | Console => =
| console => -> do
hput ConsolePut on console
put "Hello World" on console
hput ConsoleClose on console
halt consoleWhy CaMPL?
Four ideas set it apart from the concurrency you already know.
Runnable examples
Compiled to abstract-machine instructions and executed in the browser. Every terminal the program opens is a live pane.
Put a string on the console, then close the channel.
Open a string terminal, print a prompt, wait for a keypress.
Read input in a loop and echo it back until the user types 'q'.
Fork a console into two channels and plug them together concurrently.
Two terminals share a mutable memory cell — write from one, read from the other.
Two writer terminals post to a shared board using a race, with no turn-taking.
Two clients race for a lock on a memory cell, then read and update its value.
A two-player game: each player gets a terminal, sharing the board via a memory cell.