Classical strongly typed systems

Among others, we have studied the type systems of Axiom/Aldor, C++, Scheme and Caml. Let us briefly describe some of our feelings about the positive and negative sides of these type systems.

Aldor

The Aldor language is based on categories or signatures. Genericity is achieved by explicitly declaring all methods which a generic type is allowed to use by means of a category. In order to use such a method it should be explicitly imported first. The advantages of this approach are

However, the first advantage also leads to several disadvantages concerning the flexibility of the type system:

As a consequence, Aldor is mainly useful if the theory that one wishes to program is well-modelized beforehand. However, the rigidity of the type system can become a problem for large scale projects and especially research projects where models may have to be adapted as a function of time. Other disadvantages of Aldor is that is hard to write an interpreter for it, that the type inheritance system is very rigid and that it lacks of support for implicit conversions. The latter draw-backs could easily be removed though.

C++

A limited degree of genericity in C++ is achieved through the use of templates. The advantages of templates are their flexibility: not much type checking is done over the quantified variabled and their use requires no particular effort from the user. However, all possible types which are used during the execution have to be known at compile time, so that the user cannot use any real generic objects. Furthermore, templates do not behave nicely in combination with other dirty C++ “features” like the #include directive and the header-file mechanism.

Scheme

The Scheme language is nice because if its extreme simplicity, flexibility and the power of its control structures based on continuations. As many computer algebra languages (which are often based on Lisp), all type checking is done dynamically, at run-time. This has the advantage that an interpreter is extremely easy to write, but that too few type-knowledge is given to the compiler in order to produce really efficient code. Another disadvantage of the impossibility to define typed variables is that is non-trivial to integrate overloading and implicit type-conversion into the language.

Caml

The functional Caml language shares many of the advantages of the Scheme language, while providing a genuine type system. The Caml type system has the advantages that

In a sense, the second advantage is at the exact opposite of the rigid type system of Aldor: all necessary type information is determined from the code. However, this intelligence of Caml has the inconvenience that it may passes useful safety type checks. It also carries the disadvantage of Scheme that it is non-trivial to integrate overloading and implicit type-conversion.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License. If you don't have this file, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.