Polyphonic C#

Dialect of programming language C#

Polyphonic C# is an experimental dialect of C# which enhances the language with abstracts of asynchronous multithreading, based on join calculus (a formal process calculus).

Polyphonic C# was developed by Nick Benton, Luca Cardelli and Cédric Fournet from Microsoft Research, Cambridge.

The dialect duplicates all C# capabilities and adds two new elements:

  • asynchronous methods (declared with async keyword) are methods which, when called, return immediately, and the method body is scheduled for execution in an another thread — a new one, spawned for this method personally, or a worker thread from some pool.

  • chords, also called synchronization patterns, are declarations consisting of a header and a body. The header contains several method signatures, separated by & character. The body of the chord is executed only when all methods from the header have been called (the order of calls might differ from the order of declarations). Unprocessed method calls are queued up until the matching calls are done. A typical example of a chord is the following code:

    public class Buffer {
      public string Get() & public async Put(string s) {
        return s;

    Class Buffer allows to put a string into buffer asynchronously and to extract it synchronously. The body of the chord is executed when Get is called in the thread which called it.

Programs written in Polyphonic C# are interpreted by translating them into regular C#; the resulting code repeats program logic and complements it with private methods and attributes necessary to implement multithreading mechanism.

At the moment Polyphonic C# is merged in the new dialect and doesn’t get developed on its own.