D: C, C++, Java, Ada, and Eiffel got together and had a kid
Author |
Message |
wtd
|
Posted: Thu Oct 28, 2004 4:27 am Post subject: D: C, C++, Java, Ada, and Eiffel got together and had a kid |
|
|
Quite an interesting language.
http://www.digitalmars.com/d
It interfaces easily with C and C++ code, takes the best of Java and C++ object-orientation, adds some Ada in the form of "in", "out" and "inout" function and procedure parameters, and borrows contracts from Eiffel.
Compilers for Windows and Linux are provided free of charge.
The obligatory "Hello world!" that also prints out any args passed in as a demonstration of array slicing and the foreach loop.
code: | import std.stdio;
int main(char[][] args)
{
writefln("Hello world!");
if (args.length > 1)
{
writefln("The arguments to this program are:");
foreach (char[] arg, args[1 .. args.length])
{
writefln(arg);
}
}
return 0;
} |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Thu Oct 28, 2004 5:23 am Post subject: (No subject) |
|
|
Oh, and it also incorporates ObjectPascal/C# (the guy who developed Delphi at Borland was responsible for designing C#) like "properties".
code: | import sys.stdio;
class Foo
{
private int m_a;
public
{
int a()
{
return m_a;
}
int a(int newA)
{
return m_a = newA;
}
}
}
int main()
{
Foo f = new Foo;
f.a = 42;
writefln("%d", f.a);
return 0;
} |
|
|
|
|
|
|
wtd
|
Posted: Thu Oct 28, 2004 5:45 am Post subject: (No subject) |
|
|
And the ease of the Python module system... |
|
|
|
|
|
|
|