Articles

  • No categories

Overview

Threading is the most common approach to concurrency deployed in modern languages (such as Java or C#).  In this model, multiple threads compete for access to shared data and, as a result, an object’s state may change at any moment without warning — leading to complex and hard to diagnose race conditions.

An alternative approach to concurrent computation is the [[Actor model]].  Whiley implements the actor model using syntax which treats methods and functions differently.  Every method acts on a given actor, and represents a specific message that can be sent to that actor. Thus, methods in Whiley are similar those in traditional object-oriented languages (e.g. Java) which have an explicit receiver, and may have side-effects. In contrast, functions in Whiley are pure (i.e. [[Side effect (computer science)|side-effect free]]) and not associated with any actor. Methods are either synchronous (and return a value), or asychronous (and do not).