Aldor Programming Language
#include "aldor" stderr << "Hello world" << newline;
The Language
From Wikipedia:
Aldor is a programming language. It is the successor of A# as the extension language of the Axiom computer algebra system.
The Aldor language combines imperative, functional, and object-oriented features. It has an elaborate dependent type system[citation needed], allowing types to be used as first-class values. Aldor's syntax is heavily influenced by Pascal, but it is optionally indentation-sensitive, like Python. In its current implementation, it is compiled, but an interactive listener is provided.
Why Aldor?
This is of course the question every language developer is asked: Why do we need another language? Can't we do all that with other languages, already? What about the community, the library support, etc? Why do I even bother developing Aldor?
There are several reasons why I personally like Aldor very much:
- Easy syntax
The Aldor grammar is consistent and unambiguous. Both a compiler and a human reader can immediately know what a piece of code means. The meaning and semantic effect of syntax does not depend on the context.
- Few built-ins
Without a library, Aldor is pretty much an empty language. There are no integers, strings, arrays, etc. All that is defined within a library. By importing
Integer
into the current scope, integer literals gain meaning. Before that, the lexical structure of integer literals is defined by the compiler, but the value is not known. Only when a library implements a function fromLiteral
toInteger
, the literal can be assigned a value. Such a thing has recently been added to C++0x, but it's still far from what Aldor can do. - Everything is a value
The difference between types, functions and objects as it exists in C does not exist in Aldor. Aldor differentiates between constants and variables. Types, functions and objects are all values in Aldor. You may pass types to functions and let those functions return a new type based on that old type. For example, the
List
"type" is actually a function that returns a type, "List of T
" whereT
is the type passed to theList
function. - Return type overloading
In C++, Java, C# and other languages, you can overload functions by their argument types and count. In Aldor, you can additionally overload them by return type. You can also overload constants, which might be seen as nullary functions that don't need the function application operator.
to be filled
- Dependent types
These are a little like C++ templates. Basically, it means that you can have a type that depends on a value. You can then use regular Aldor control structures to construct a type based on that value.
to be filled
The output from the above code would be:
4 2
The value a type depends on may be any constant value of any type, unlike in C++, where only types, integers, templates and pointers are allowed. Since types are values in Aldor, you can also have types depending on other types, which would be the
template<typename T>
construct in C++.