Libraries are important
Nowadays one rarely choose a programming language without having a look at the
One of the strength of Perl is CPAN (Comprehensive Perl Archive Network).
Java has also managed to have a large set of libraries.
Lists, dictionaries, strings are part of libraries. But having useful and
powerful libraries working on these objects is *real* hard without the help of
Without modules, one can't have short function names, making the library
harder to use. The name conflicts are hard to solve.
Languages badly missing modules: C, PHP4
- Garbage Collector
Without a garbage collector, you have to decide who is allocating and -even
worse- who is deallocating the objects.
Languages badly missing garbage collection: C, C++
- Generics / Templates / Parametric Polymophism
Without generics, you can't have statically typed containers. The typical
example is Java's list: you need to downcast back to the object's real type
when taking something out of it:
ArrayList result = new ArrayList();
String s = (String) result.get(0);
(note the "(String)" cast)
Languages badly missing generics: C, Java, C#
- Overloaded functions
Without function overloading, part of the problems of the absence of modules
are still there. For example in OCaml "length" is either "Array.length" or
"List.length" or "String.length" ; you have to choose which one you want.
Languages badly missing overloaded functions: OCaml
- Overloaded operators
This is a special syntactical issue. Some people tend to dislike overloaded
operators. But if you want things like numbers or strings to be handled in a
library, you don't have much choice. Without overloaded operators, you need
special cases in the language for handling things like equality or
Languages badly missing overloaded operators: Java (this may change), Delphi-Kylix
- Anonymous Functions
Without anonymous functions, having simple things like "finding an element in
a list" or "a custom sort" is tedious. For example Java doesn't even have a
"find" method, acknowledging the difficulty to use "find" without anonymous
Languages badly missing anonymous functions: C, C#, C++, Java (but anonymous inner classes)
Without exceptions error reporting is hard. You usually have to resort to
returning "special" values like -1, which is hard to remember/use, and is
dangerous (unchecked errors in C cause many problems including security
Languages badly missing exceptions: C
- Exceptions in Function Prototypes
Java is the first language I know forcing people to declare the exceptions
thrown by a function. This has the nice advantage of documenting the API, and
forcing this documentation to be up to date.
Exception inference a la ML type inference would be quite easy
Languages missing exceptions declaration in function prototypes: C, C++, C#, OCaml
(for ints, floats...)
- Compile-time checks of sub-languages (printf, regexps...)
printf is a typical example where compile-time type-checking is useful and
needed. Most languages use an ad'hoc solution in the compiler to handle this
(eg: C, OCaml). Another example is regexps which could return a tuple instead
of a list of matches. Some other examples: pack/unpack (created in Perl for
Pliant and Cayenne can achieve this.
C++ may be able to achieve this using templates?
Maybe also camlp4?
This document is licensed under GFDL (GNU Free Documentation License).
Release: $Id: libraries-need-features.html,v 1.4 2002/05/17 15:22:56 pixel_ Exp $