encyclopegia.org

Whiley (programming language)

Whiley is an experimental programming language that combines features from the functional and imperative programming paradigms, and supports formal specification through function preconditions, postconditions and loop invariants. The language uses flow-sensitive typing also termed flow typing. The Whiley project began in 2009 in response to the "Verifying Compiler Grand Challenge" put forward by Tony Hoare in 2003. The first public release of Whiley was in June, 2010. Developed by David Pearce mainly, Whiley is an open source project with contributions from a small community. The system has been used for student research projects and in teaching undergraduate classes. It was supported from 2012–2014 by the Royal Society of New Zealand's Marsden Fund. The Whiley compiler generates code for the Java virtual machine (JVM) and can interoperate with Java and other JVM-based languages.

Whiley is an experimental programming language that combines features from the functional and imperative programming paradigms, and supports formal specification through function preconditions, postconditions and loop invariants. The language uses flow-sensitive typing also termed flow typing. The Whiley project began in 2009 in response to the "Verifying Compiler Grand Challenge" put forward by Tony Hoare in 2003. The first public release of Whiley was in June, 2010. Developed by David Pearce mainly, Whiley is an open source project with contributions from a small community. The system has been used for student research projects and in teaching undergraduate classes. It was supported from 2012–2014 by the Royal Society of New Zealand's Marsden Fund. The Whiley compiler generates code for the Java virtual machine (JVM) and can interoperate with Java and other JVM-based languages. // Define the type of natural numbers type nat is (int x) where x >= 0 public function indexOf(int[] items, int item) -> (int|null index) // If int returned, element at this position matches item ensures index is int ==> items[index] == item // If int returned, element at this position is first match ensures index is int ==> no { i in 0 .. index | items[i] == item } // If null returned, no element in items matches item ensures index is null ==> no { i in 0 .. |items| | items[i] == item }: // nat i = 0 // while i In the above, the function's declared return type is given the union type int|null which indicates that either an int value is returned or null is returned. The function's postcondition is made of three ensures clauses, each of which describe different properties that must hold of the returned index . Flow typing is employed in these clauses through the runtime type test operator, is . For example, in the first ensures clause, the variable index is retyped from int|null to just int on the right-hand side of the implication operator (i.e. ==> ). The above example also illustrates the use of an inductive loop invariant. The loop invariant must be shown to hold on entry to the loop, for any given iteration of the loop and when the loop exits. In this case, the loop invariant states what is known about the elements of the items examined so far, namely, that none of them matches the given item . The loop invariant does not affect the meaning of the program and, in some sense, may be considered unneeded. However, the loop invariant is required to help the automated verifier using in the Whiley compiler to prove this function meets its specification. The above example also defines the type nat with an appropriate type invariant. This type is used to declare variable i and indicate that it can never hold a negative value. In this case, the declaration prevents the need for an added loop invariant of the form where i >= 0 which would otherwise be needed. Whiley began in 2009 with the first public release, v0.2.27 following in June 2010 and v0.3.0 in September that year. The language has evolved slowly with many syntax changes made to-date. Versions prior v0.3.33 supported first-class string and char data types, but these were removed in favour of representing strings as constrained int[] arrays. Likewise, versions prior to v0.3.35 supported first-class set (e.g., {int} ), dictionary (e.g., {int=>bool} ) and resizeable list [int] ), but these were dropped in favour of simple arrays (e.g., int[] ). Perhaps most controversial was the removal of the real datatype in version v0.3.38 . Many of these changes were motivated by a desire to simplify the language and make compiler development more manageable. Another important milestone in the evolution of Whiley came in version v0.3.40 with the inclusion of reference lifetimes, developed by Sebastian Schweizer as part of his Master's degree thesis at the University of Kaiserslautern.

References

No reference rows published for this article.

Cite this article

MLA

"Whiley (programming language)." encyclopegia.org, 2025, https://encyclopegia.org/wiki/whiley-programming-language. Accessed 24 November 2026.

Chicago

"Whiley (programming language)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/whiley-programming-language.

APA

encyclopegia.org. (2025). Whiley (programming language). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/whiley-programming-language

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Stonewall Brigade Band

enwiki · references available

2015 Las Vegas Bowl

enwiki · references available

AIST (missile)

enwiki · references available

43rd Annie Awards

enwiki · references available

No. 30 Squadron IAF

enwiki · references available

No. 32 Squadron IAF

enwiki · references available
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1308864011 · 0.5 · snapshot enwiki-001308864011

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.