
-----------------------------------
wtd
Thu Oct 28, 2004 4:27 am

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.  :)

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;
}

-----------------------------------
wtd
Thu Oct 28, 2004 5:23 am


-----------------------------------
Oh, and it also incorporates ObjectPascal/C# (the guy who developed Delphi at Borland was responsible for designing C#) like "properties".

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
Thu Oct 28, 2004 5:45 am


-----------------------------------
And the ease of the Python module system...
