13

Say it in D

April 13, 2008 by Rasmus, tagged code, d, osx, programming and tango, filed under software

gdc-tango-installer-screenshot

I just released a true Mac-style simple installer package which gives you a complete D with Tango-programming environment.

Included is GDC with libgtango together with a complete set of D and Tango documentation as well as about 50 different examples with complete source code. Installs into standard paths and does not interfere with your current environment (using isolating prefix /usr/share/gdc). This package does not require Apple Developer tools, even though it is highly recommended.

D is a general purpose systems and applications programming language. It is a higher level language than C++, but retains the ability to write high performance code and interface directly with the operating system API’s and with hardware. D is well suited to writing medium to large scale million line programs with teams of developers. D is easy to learn, provides many capabilities to aid the programmer, and is well suited to aggressive compiler optimization technology.

/* Shows how to create a basic socket client, and how to converse
   with a remote server. */
import tango.io.Console;
import tango.net.SocketConduit,
       tango.net.InternetAddress;

void main() {
  // make a connection request to the server
  auto request = new SocketConduit;
  request.connect(new InternetAddress("localhost", 8080));
  request.output.write("hello\n");

  // wait for response (there is an optional timeout supported)
  char[64] response;
  auto size = request.input.read(response);

  // close socket
  request.close;

  // display server response
  Cout(response[0..size]).newline;
}

13 comments

  • Avatar

    wow, awesome!!! this is sooo cool! thx a lot rasmus!! installing a current version on leopard was always a bit tricky / time consuming…

  • Avatar

    Nice to see D installers springing up!

    I managed to spew-out some packages for Ubuntu/Debian and really was wondering about how things were with Mac. I guess you answered me :D…

    Excellent work! Keep it up…

  • Avatar

    After installed your package and tried to compile the examples:

    $ make all
    Building : concurrency/fiber_test
    bud concurrency/fiber_test.d -noautoimport -op -clean -full -g -debug -I.. -Tconcurrency/fiber_test -unittest
    make: bud: Command not found
    make: *** [concurrency/fiber_test] Error 127

    and hello.d

    $ gdc hello.d
    Unsupported environment; neither Win32 or Posix is declared
    /usr/share/gdc/bin/../lib/gcc/i386-apple-darwin9.2.2/4.1.2/../../../../include/d/4.1.2/tango/sys/Common.d:83: static assert is false

  • Avatar

    @jag: You need to define -version Posix as well as link with tango and in your case also pthreads.
    I have defined an alias which I use for convenience:
    alias dmd=$(which gdmd)’ -version=Posix -L-lgtango -L-lpthread’
    You can put it in your .profile if you like.
    I tried dmd fiber_test.d and it works for me with this setup. Hope I helped you in some way!

    @Valeriu Palos: Thanks! Great! I’ve been using ugly .deb-files on my server. Now I can finally put it through Aptitude.

  • Avatar

    What do you think of adding more libraries to the installer? And, someone on Mac OS 10.4 or PowerPC who can build packages for those platforms? If so, there is a very simple (almost fully automatic) way of doing so. Just contact me.

  • Avatar

    Wow, this is awesome … nice work

  • Avatar

    Can I use this package somehow with dsss?

  • Avatar

    Hi Rasmus, more work I know, but I think that packaging dsss,gdc,tango and tangobos, and maybe multiarray, would make it really great.
    I think that I could do it for tiger (that is my setup).
    Also you might want to check the patches I submitted to tango in particular ticket #1007 and #1008

  • Avatar

    @doob: I do not use dsss myself, so I can’t give you a good answer. But the GDC and Tango in this package is as standard and clean as it can be and should work with anything that counts on a standard GDC+Tango environment.

    @fawzi: I’ve replied by mail and included instructions on how to create a package.

  • Avatar

    Nice job :)

    Btw, I can’t get your RSS feed to work.

  • Avatar

    @larsivi: Hey Lars! Thanks for the heads-up on the feed issue. A typo – fixed now.

  • Avatar

    @Rasmus: This package installs gdc in /usr/share/gdc and what I know of that’s not default.

  • Avatar

    @doob: If we were to install it into, let’s say /usr, there would be namespace collisions i.e. /usr/bin/gcc would already exist. What the installer does is creating symlinks from /usr to /usr/share/gdc (manual pages, binaries, etc). The uninstall.command (found in /Developer/Documentation/D) removes all symlinks and /usr/share/gdc.

Comment