D, Java? To D or not to D?
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Fri Jan 5 06:11:49 PST 2007
Alexander Panek wrote:
> TPJ wrote:
>> And now I have found D. What can I say about it?
>>
>> Disadvantages:
>>
>> 1) In order to run a program written in D I have to compile it on the
>> target OS.
>>
>
> Gregor Richards has found a way to compile D code to JVM compatible
> programs, that can be run in a JVM. So, if this is taken a bit further,
> maybe we can even say "D runs in a VM, too, if you want".
From what I remember it'll run but it won't be pretty...
IIRC he used GDC to compile to MIPS and then translated that to
bytecode, using a huge array to simulate raw memory...
But yeah, if you _need_ it to run on a JVM, this may be an option.
I'm pretty sure he didn't get access to Java classes that way though.
>> 2) D might be perceived as an alternative to Java or C# (I don't count
>> C/C++).
>> But it is really the case? Java was born in 1995, today it's a very known
>> language. C# was born in 1999, today it's popularity is still rising.
>> And D?
>> Mars was born in 1988, D in 1999. How many people have heard about D? In
>> comparison, say, to C#? How many apps and libraries are written in
>> Java, in
>> C#, and in D?
>>
>
> You can't compare Sun & Microsoft to a one man show (AFAIK) like
> Digitalmars. Those are other dimensions of marketing and promotion, really.
Yeah, D is much better than Java (never really used C#, so can't compare).
But Java and .NET definitely have a bigger PR department, so it's not
surprising they get all the press.
>> 3) There is no D for mobile phones (AFAIK).
>>
>
> There's a guy that tries to get D working on a Nokia 770, I hope he got
> it working. Apart from that, as D can theoretically be run in a JVM, ..
> you know the rest.
He got it working:
Photo: http://www.flickr.com/photos/michaeldominic/329290303/
Coverage:
http://dblog.aldacron.net/2006/12/22/d-gets-nokiafied/
http://pvanhoof.be/blog/index.php/2006/12/22/d-on-the-nokia-770
>> Advantages:
>>
>> 1) It's said to be faster than Java. But is it really an advantage? I
>> find
>> Java fast enough for my needs, so why should I bother myself with D?
>>
>
> I don't know how the speed advantage over Java is, but there's
> definitely more room for optimization than with Java. I can't answer you
> the question why you should bother yourself with D. That's your
> decision, after all. ;)
FWIW:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=dlang&lang2=java
>> 2) From FAQ: Since D can call C functions, any GUI library with a C
>> interface
>> is accessible from D.
>> Does it mean that I can access *any* C library from D? If so, it a
>> great feature!
>>
>
> Yes, any C library. Apart from that, there's a tool to bind C++
> libraries, too. (BCDgen on dsource)
You need to convert C headers to D import modules to use them though.
It shouldn't be too hard unless too much preprocessor tricks are used,
but it might be a bit of work for large files.
IIRC there's a tool that at least provides you with a starting point for
that, not sure how far along it is these days.
>> Why I ask all those questions, you may ask. Well - the truth is that:
>> 1) I know Java.
>> 2) I don't know C#.
>> 3) I don't know D.
>> 4) I might be wrong.
>>
>> Therefore I post this message here. I'd like to know what you (the
>> people who
>> know D) say about it.
I definitely prefer D over Java, but I've never written a program that
needed to run on multiple operating systems and architectures.
You'll also have to use GDC to compile on anything but x86 Linux &
windows, and I don't have much experience with it. Haven't heard much
complaints about it though, and the Mac people definitely seem to like
it :).
Theoretically it should eventually be portable to all architectures GCC
supports, but IIRC it still needs some work in that department.
More information about the Digitalmars-d
mailing list