Difference between revisions of "Language features"

From Clean
Jump to navigationJump to search
Line 1: Line 1:
A functional programming language like Clean is based on the concept of mathematical functions. Clean is a pure functional language, there is not such a thing as an assignment. This has a big advantage: a function cannot have a side-effect. A Clean function is referential transparent: the result of a function only depends on the value of the function arguments and on nothing else.
+
Clean is a general purpose, state-of-the-art, pure and lazy functional  
 +
programming language designed for making real-world applications.
 +
Here is a list of the most notable language features:
  
This has important consequences:
+
* Clean is a lazy, pure, and higher-order functional programming language with explicit graph-rewriting semantics.  
* Once a function is working, it will always work. A function will always react in the same way, regardless when and in which context the function is used; One can reason about Clean functions and the Clean program as a whole (which is a function application) by using traditional mathematical reasoning: uniform substitution and mathematical induction.
 
* For making real world applications one needs of course to be able to update a database, perform I/O, update an array destructively, pass a message to another program. And, the application should run efficiently enough. Although Clean does not have assignments, objects can be updated destructively. Clean is the only functional language in the world which has a special type system, uniqueness typing. This type system is developed in Nijmegen. It enables to update function arguments destructively retaining the purity of the language.
 
  
== Research Concepts Used in Clean ==
+
* Although Clean is by default a lazy language, one can smoothly turn it into
The Software Technology Research Group is working on functional languages since 1984. Many new concepts which are now commonly used in the functional language community have been introduced by our group (such as term graph rewriting, lazy copying, abstract reduction, uniqueness typing, Clean's Object I/O concept, concurrent and parallel aspects of Clean, dynamic typing) have a look at our [[publications]].
+
a strict language to obtain optimal time/space behavior: functions can be
 +
defined lazy as well as (partially) strict in their arguments; any (recursive)
 +
data structure can be defined lazy as well as (partially) strict in any of its
 +
arguments.
  
== Feature List of the Clean Language ==
+
* Clean is a strongly typed language based on an extension of the well-known
For people who are familiar with other functional languages, such as Haskell, we give here a short list with the features of the language. For more information on the language, look here.
+
Milner/Hindley/Mycroft type inferencing/checking scheme including the common
 +
higher-order types, polymorphic types, abstract types, algebraic types, type
 +
synonyms, and existentially quantified types.
  
* Clean is a lazy, pure, higher-order functional programming language with explicit graph-rewriting semantics; one can explicitly define the sharing of structures (cyclic structures as well) in the language;
+
* Clean has pattern matching, guards, list comprehensions, array
* Although Clean is by default a lazy language one can smoothly turn it into a strict language to obtain optimal time/space behavior: functions can be defined lazy as well as (partially) strict in their arguments; any (recursive) data structure can be defined lazy as well as (partially) strict in any of its arguments;
+
comprehensions and a lay-out sensitive mode.
* Clean is a strongly typed language based on an extension of the well-known Milner / Hindley / Mycroft type inferencing/checking scheme (Milner 1978; Hindley 1969; Mycroft 1984) including the common higher order types, polymorphic types, abstract types, algebraic types, synonym types and existentially quantified types;
+
 
Due to the strong typing of Clean and the obligation to initialize all objects being created run-time errors can only occur in a very limited number of cases: when partial functions are called with arguments out of their domain (e.g. dividing by zero), when arrays are accessed with indices out-of-range and when not enough memory (either heap or stack space) is assigned to a Clean application;
+
* Clean supports type classes and type constructor classes to make overloaded  
* Type classes and type constructor classes are provided to make overloaded use of functions and operators possible;
+
use of functions and operators possible.
* Clean offers the following predefined types: integers, reals, Booleans, characters, strings, lists, tuples, records, (destructively updateable) arrays and files;
+
 
* Clean has pattern matching, guards, list comprehensions and array comprehensions and a lay-out sensitive mode;
+
* The uniqueness typing system of Clean makes it possible to develop efficient
* One can define functions on a local level using where blocks, let expressions (even before a guard)  and strict let expressions;
+
applications. In particular, it allows a refined control over the single-threaded  
* Clean's key feature is a polymorphic uniqueness type inferencing system, a special extension of the Milner / Hindley / Mycroft type inferencing/checking system allowing a refined control over the single threaded use of objects; with this uniqueness type system one can influence the time and space behavior of programs; it can be used to incorporate destructive updates of objects within a pure functional framework, it allows destructive transformation of state information, it enables efficient interfacing to the non-functional world (to C but also to I/O systems like X-Windows) offering direct access to file systems and operating systems;
+
use of objects which can influence the time and space behavior of
* Clean is a modular language allowing separate compilation of modules; one defines implementation modules and definition modules; there is a facility to implicitly and explicitly import definitions from other modules;
+
programs. Uniqueness typing can also be used to incorporate destructive
* Clean offers a sophisticated I/O library with which window based interactive applications (and the handling of menus, dialogues, windows, mouse, keyboard, timers and events raised by sub-applications) can be specified compactly and elegantly on a very high level of abstraction;
+
updates of objects within a pure functional framework. It allows destructive  
GUI-based programs written in Clean using the 0.8 I/O library can be ported without modification of source code to anyone of the many platforms we support.
+
transformation of state information and enables efficient interfacing to the  
* There are many [[official libraries|libraries]] available offering additional functionality.
+
nonfunctional world (to C but also to I/O systems like X-Windows) offering  
 +
direct access to file systems and operating systems.
 +
 
 +
* Clean offers records and (destructively updateable) arrays and files.
 +
 
 +
* The Clean type system supports dynamic types, allowing values of arbitrary
 +
types to be wrapped in a uniform package and unwrapped via a type annotation at
 +
run time. Using dynamics, code and data can be exchanged between Clean applications
 +
in a flexible and type-safe way.
 +
 
 +
* Clean provides a built-in mechanism for generic functions.
 +
 
 +
* There is a Clean IDE and there are many [[libraries]] available offering additional functionality.

Revision as of 14:56, 6 July 2010

Clean is a general purpose, state-of-the-art, pure and lazy functional programming language designed for making real-world applications. Here is a list of the most notable language features:

  • Clean is a lazy, pure, and higher-order functional programming language with explicit graph-rewriting semantics.
  • Although Clean is by default a lazy language, one can smoothly turn it into

a strict language to obtain optimal time/space behavior: functions can be defined lazy as well as (partially) strict in their arguments; any (recursive) data structure can be defined lazy as well as (partially) strict in any of its arguments.

  • Clean is a strongly typed language based on an extension of the well-known

Milner/Hindley/Mycroft type inferencing/checking scheme including the common higher-order types, polymorphic types, abstract types, algebraic types, type synonyms, and existentially quantified types.

  • Clean has pattern matching, guards, list comprehensions, array

comprehensions and a lay-out sensitive mode.

  • Clean supports type classes and type constructor classes to make overloaded

use of functions and operators possible.

  • The uniqueness typing system of Clean makes it possible to develop efficient

applications. In particular, it allows a refined control over the single-threaded use of objects which can influence the time and space behavior of programs. Uniqueness typing can also be used to incorporate destructive updates of objects within a pure functional framework. It allows destructive transformation of state information and enables efficient interfacing to the nonfunctional world (to C but also to I/O systems like X-Windows) offering direct access to file systems and operating systems.

  • Clean offers records and (destructively updateable) arrays and files.
  • The Clean type system supports dynamic types, allowing values of arbitrary

types to be wrapped in a uniform package and unwrapped via a type annotation at run time. Using dynamics, code and data can be exchanged between Clean applications in a flexible and type-safe way.

  • Clean provides a built-in mechanism for generic functions.
  • There is a Clean IDE and there are many libraries available offering additional functionality.