Hope (programming language)


Hope is a small functional programming language developed in the 1970s at the University of Edinburgh.
It predates Miranda and Haskell and is contemporaneous with ML, also developed at the University. Hope was derived from NPL, a simple functional language developed by Rod Burstall and John Darlington in their work on program transformation. NPL and Hope are notable for being the first languages with call-by-pattern evaluation and algebraic data types.
Hope was named for Sir Thomas Hope, a Scottish agricultural reformer, after whom Hope Park Square in Edinburgh, the location of the Department of Artificial Intelligence at the time of the development of Hope, was also named.

Language details

A factorial program in Hope is:
dec fact : num -> num;
--- fact 0 <= 1;
--- fact n <= n*fact;
Changing the order of the clauses does not change the meaning of the program, because Hope's pattern matching always favors more specific patterns over less specific ones. Explicit type declarations in Hope are required; there is no option to use a type-inference algorithm in Hope.
Hope provides two built-in data structures: tuples and lists.

Implementations

The first implementation of Hope was strict, but since that one there have been lazy versions and strict versions with lazy constructors. British Telecom embarked on a project with Imperial College to implement a strict version. The first release was coded by Thanos Vassilakis in 1986. Further releases were coded by Mark Tasng of British Telecom. A successor language Hope+ added annotations to dictate either strict or lazy evaluation.
Roger Bailey's Hope tutorial in the August 1985 issue of BYTE references an interpreter for IBM PC DOS 2.0.