# Claire (programming language)

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Claire_(programming_language)
> Markdown URL: https://mediated.wiki/source/Claire_(programming_language).md
> Source: https://en.wikipedia.org/wiki/Claire_(programming_language)
> Source revision: 1317280819
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages) This article relies excessively on references to primary sources. Please improve this article by adding secondary or tertiary sources. Find sources: "Claire" programming language – news · newspapers · books · scholar · JSTOR (February 2018) (Learn how and when to remove this message) This article includes a list of references, related reading, or external links, but its sources remain unclear because it lacks inline citations. Please help improve this article by introducing more precise citations. (December 2019) (Learn how and when to remove this message) (Learn how and when to remove this message)

Claire Paradigm multi-paradigm: functional, object-oriented (class-based), rule processing, reflective Designed by Yves Caseau First appeared 1994; 32 years ago (1994) Stable release 3.3.46 / February 17, 2009; 17 years ago (2009-02-17) Typing discipline strong, both static and dynamic OS Cross-platform License Apache 2.0 Filename extensions .cl Website www.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](/source/Functional_programming) and [object-oriented](/source/Object-oriented_programming) [programming language](/source/Programming_language) with [rule processing](/source/Production_system_(computer_science)) abilities. It was designed by Yves Caseau at [Bouygues](/source/Bouygues)' e-Lab research laboratory, and received its final definition in 2004.

Claire provides:

- A simple [object system](/source/Object_system) with [parametric](/source/Polymorphism_(computer_science)#Parametric_polymorphism) [classes](/source/Class_(programming)) and [methods](/source/Method_(computer_programming))

- [Polymorphic and parametric](/source/Polymorphism_(computer_science)) functional programming

- [Production rules](/source/Production_system_(computer_science)) triggered by [events](/source/Event_condition_action)

- Versioned snapshots of the state of the whole system, or any part, supporting [rollback](/source/Rollback_(data_management)) and easy exploration of [search spaces](/source/Search_algorithm)

- Explicit relations between entities; for example, two entities might be declared inverses of one another

- [First-class](/source/First-class_object) [sets](/source/Set_(abstract_data_type)) with convenient [syntax](/source/Syntax_(programming_languages)) for set-based programming

- An expressive set-based type system allowing both [second-order](/source/Higher-order_programming) [static](/source/Static_typing) and [dynamic](/source/Dynamic_typing) typing

Claire's [reference implementation](/source/Reference_implementation), consisting of an interpreter and compiler, was fully [open-sourced](/source/Free_and_open-source_software) with the release of version 3.3.46 in February 2009. Another implementation, WebClaire, is supported [commercially](/source/Commercial_software).

Claire has, since 2022, a new reference version, CLAIRE4, which is written on the [Go language](/source/Go_(programming_language)). It has a [new website](https://sites.google.com/view/claire4/home) with documentations and examples, together with a [Github](https://github.com/ycaseau/CLAIRE4) open source repository.

## Overview

Claire is a [general-purpose programming language](/source/General-purpose_programming_language), best suited to [application software](/source/Application_software) requiring sophisticated [data modeling](/source/Data_modeling), rule processing or problem solving. WebClaire adds extensions for fuller integration with the [operating system](/source/Operating_system) and for programming [web applications](/source/Web_application).

Though Claire can be used for complete projects, it is designed to integrate smoothly with [C++](/source/C%2B%2B), [Java](/source/Java_(programming_language)), or [Go](/source/Go_(programming_language)).

The key set of features that distinguishes Claire from other programming languages has been dictated by experience in solving complex optimization problems. Two features not found in other mixed functional/object-oriented languages, such as [OCaml](/source/OCaml), [Scala](/source/Scala_(programming_language)) and [F#](/source/F_Sharp_(programming_language)), are *versioning* and *production rules*.

Versions can be viewed as a stack of snapshots of some part of the system, which can be made as large (for expressiveness) or small (for efficiency) as necessary. Creation and roll-back of versions permit [backtracking](/source/Backtracking), as found in [logic programming](/source/Logic_programming), though Claire's backtracking may cover any user-defined structure rather than just a set of logic variables.

A production rule in Claire is composed of an event, a condition and a response to be evaluated if the condition is satisfied. An event may be any change in an object's slot or the instantiation of a class, and a response may itself set off further events. Such production rules are especially useful in describing reactive algorithms, such as those for [constraint](/source/Constraint_programming) propagation.

Claire was created as a successor to LAURE, an expressive but complex language designed by Caseau in the 1980s that combined many paradigms. Claire was intended to be both easier to learn than its predecessor and to impose no performance overhead relative to C++; it is thus a much smaller language, omitting features such as [constraints](/source/Constraint_satisfaction) and [deductive](/source/Deductive_language) rules, and is closer to [C](/source/C_(programming_language)) in spirit and syntax. Its main users in industry have been the [Bouygues](/source/Bouygues) and [Thales Groups](/source/Thales_Group). The new Claire 4 release brings gains in reliability (via Go's strength as underlying language) and in performance of [compiler](/source/Compiler) and [interpreter](/source/Interpreter_(computing)).

## Example

A function to compute the *n*th [Fibonacci sequence](/source/Fibonacci_sequence) number:

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

## External links

- [Official website](http://claire3.free.fr)

- [Claire4](https://github.com/ycaseau/CLAIRE4) on [GitHub](/source/GitHub)

- [Claire4-specific website](https://sites.google.com/view/claire4/home)

- [Documentation](https://web.archive.org/web/20111001163413/http://www.claire-language.com/pub/trunk/xl/doc/claire.index.html), Claire, WebClaire

- "[Introduction to the Claire Programming Language Version 3.2](https://web.archive.org/web/20110607212054/http://www.dcs.gla.ac.uk/~pat/cp4/claire/Claire_3.2.pdf)" by Yves Caseau and François Laburthe

- "[Claire: Combining Sets, Search and Rules to Better Express Algorithms](http://trac.claire-language.com/cgi-bin/trac.cgi/raw-attachment/wiki/Papers/combi_set_search_rules_algo.pdf)[*[permanent dead link](https://en.wikipedia.org/wiki/Wikipedia:Link_rot)*]" by Yves Caseau, François-Xavier Josset and François Laburthe (2002). A 26-page overview, written for academic audience, with benchmarks

---
Adapted from the Wikipedia article [Claire (programming language)](https://en.wikipedia.org/wiki/Claire_(programming_language)) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Claire_(programming_language)?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
