Multi-Paradigm Programming
A tutorial by
Michael Hanus
to be held on March 26, 2000
at the European
Joint Conferences on Theory and Practice of Software (ETAPS)
Summary:
This tutorial provides an overview of high-level languages and
programming techniques that combine different programming paradigms.
The main emphasis is on declarative languages since they support a
high-level style of programming and appropriate abstraction facilities.
In particular, we show that functional languages are a good starting
point for multi-paradigm programming since they can be extended
in small steps to support
- logic programming,
- constraint (logic/functional) programming,
- object-oriented programming,
- concurrent programming, and
- distributed programming
in a single language. For the discussion of concrete examples,
we use the language
Curry
which is an extension of Haskell
to support all these programming styles in a seamless way.
The development of Curry is an international initiative
to provide a common platform for the research, teaching
and application of high-level (declarative) multi-paradigm languages.
Although the design and implementation of Curry is still under development,
various implementations are available.
Objectives:
This tutorial provides an overview of the development
of multi-paradigm languages. It shows methods
to combine different programming paradigms so that
programmers can benefit from the features of the different
paradigms. In particular, it will be shown that declarative
programming is not only a niche for some special applications
but can be combined with features for I/O, concurrency and
distributed programming so that complex systems
(including graphical user interfaces, Internet programming,
database access, etc.) can be implemented in a high-level manner.
This has a positive impact on the programmer's productivity
as well as on the reliability of the developed systems.
Intended audience:
Academic and industrial people interested in high-level programming languages.
A background on declarative (functional or logic) programming
might be helpful but is not required for the tutorial.
Some details about the tutorial:
The general structure of the tutorial will be as follows.
The starting point is a purely functional language
to sketch the use of standard features like laziness,
higher-order programming, and polymorphism. Then we will add step by step
the necessary extensions to support various other programming
paradigms, like
- logic variables, non-deterministic evaluation and search
operators for logic programming
- constraint solvers as a generalization of unification
for constraint programming
- suspension and concurrent evaluation for concurrent evaluation
- object-oriented programming via recursive functions
with message streams as input
- communication ports for distributed programming on the Internet
- monads for imperative programming and I/O
For concrete examples the multi-paradigm language
Curry
is used since it supports all these features and is a conservative
extension of the lazy functional language
Haskell.
However, we will also discuss other languages with similar goals,
like Oz,
Mercury,
Escher,
or Erlang.
To get a more detailed impression of the proposed tutorial,
we outline its contents below:
- Introduction:
- general idea of declarative programming
- advantages w.r.t. imperative programming
- Functional programming:
- data types
- equations
- pattern matching
- reduction
- strict vs. lazy evaluation
- optimal evaluation strategies (needed reduction)
- higher-order functions
- From functional to logic programming:
- logic variables
- binding through pattern matching
- non-determinism
- optimal evaluation strategies (needed narrowing)
- strict equality and unification
- non-deterministic functions and demand-driven search
- search strategies (encapsulated search)
- Constraint programming:
- extending the Herbrand domain
- examples for constraints over reals and finite domain constraint programming
- From functional logic programming to concurrent programming:
- suspension and synchronization on logic variables
- concurrent evaluation of constraints
- parallel functional programming
- Programming with concurrent objects:
- implementation of concurrent objects as constraints
- stream-oriented communication
- ports for efficient many-to-one communication
- From concurrent to distributed programming:
- making program entities externally accessible:
- external ports in Curry
- external objects in Oz
- registered processes in Erlang
- examples for distributed programming (client-server, DNS, talk, etc.)
- Combining declarative programs with the real world:
- external functions
- monadic programming
- I/O monad
- graphical user interfaces
- Summary:
- short overview of existing languages and systems
Further infos:
Michael Hanus