Jump to content

Claire (programming language)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Chri1753 (talk | contribs) at 03:39, 2 October 2009 (Continued revisions). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Claire
Paradigmmulti-paradigm: functional, object-oriented (class-based), rule processing, reflective
Designed byYves Caseau
First appeared1994 (1994)
Stable release
3.3.46 / February 17, 2009; 16 years ago (2009-02-17)
Typing disciplinestrong, both static and dynamic
OSCross-platform
LicensePermissive free software license
Filename extensions.cl
Websitewww.claire-language.com
Major implementations
Claire (reference implementation), WebClaire
Influenced by
Smalltalk, SETL, OPS5, Lisp, ML, C, LORE, LAURE

Claire is a high-level functional and object-oriented programming language with rule processing capabilities. Its main designer is Yves Caseau.

Claire provides:

Claire's canonical implementation, providing both an interpreter and a compiler, was fully open-sourced with the release of version 3.3.46 in February 2009. Another implementation, WebClaire, is commercially supported.

Overview

Claire is a general-purpose language, most suitable for sophisticated applications that involve complex data modeling, rule processing and problem solving.

Though it can be used for complete projects, Claire also integrates smoothly with C++ or Java: programs may incorporate C++ or Java code, and Claire code may be translated into C++ or Java for use in C++ or Java projects.

The key set of features that distinguishes Claire from other programming languages has been dictated by experience gained in solving complex optimization problems. Two features not found in other mixed functional/object-oriented languages, such as OCaml, Scala or F#, are versioning and production rules:

  • versioning: Claire supports versioning of a user-selected view of the entire system. The view can be made as large (for expressiveness) or as small (for efficiency) as is necessary. Versions are created linearly and can be viewed as a stack of snapshots of the system. Claire supports very efficient creation/roll-back of versions, which constitutes the basis for powerful backtracking, a key feature for problem solving. Unlike most logic programming languages, this type of backtracking covers any user-defined structure, not simply a set of logic variables.
  • production rules: Claire the creation or alteration of an object slot or a class instantiation Claire expression. Whenever an event - a change in an object's slot, or an instantiation of a class - occurs, if the condition is verified, then the conclusion is evaluated. The emphasis on events is a natural evolution from rule-based inference engines and is well suited to the description of reactive algorithms such as constraint propagation.

Claire was designed on the basis of experience with LAURE, a language developed in the 1980s with . Claire was designed to be easier to learn than LAURE and is much smaller, omitting features of LAURE such as constraints and deductive rules; it is also closer to C in spirit and syntax.

Example

A function to compute the nth fibonacci number:

fib(n:integer) : integer
-> (if (n < 2) 1
else fib(n - 1) + fib(n - 2))