6 ms·
The Case for D
- stevejohnson 17y agoD is well-designed and has many wonderful features, but its documentation is so bad as to make it unusable for serious work. This article is the best reference work on D2 that I have yet seen, which should not be the case. Also, this guy has been working on the book for over two years now. Even when it's done, it's going to be just like Grails is now: you can read the online docs, but you don't really get it until you read a certain book.
- dkersten 17y agoThe Phobos vs Tango thing put me off too.
- martincmartin 17y ago> you can read the online docs, but you don't really get it until you read a certain book. Isn't that expected and normal for anything that involves thinking about things a different way? D has language features that most programmers aren't familiar with, so to use the effectively involves a shift of thinking. Same with Grails.
- sketerpot 17y agoI learned Python by reading the official tutorial and hacking away until it made sense. I did the same for O'Caml, and later for Haskell (although that one took longer). Isn't that normal?
- WalterBright 17y agoI tend to learn languages by writing compilers for them. I'm sure that isn't normal <g>.
- stevejohnson 17y agoIt's not that books are bad, it's that there is only one book. If it's not in The Book, you essentially can't find it anywhere, unless your mailing list spelunking skills are particularly good.
- FeepingCreature 17y agoI never read The Book, instead learning the language entirely by the spec. It's honestly not that hard.
- shin_lao 17y agoThe question is, is D better enough than C++ to make us switch? When taking over you must not just be better, you must be a hell better to justify the cost of the switch.
- steveklabnik 17y agoAs always, it depends on what you want. I personally find D to be way better than C++, or I wouldn't be writing a kernel in it. Of course, individual tastes may vary.
- Keyframe 17y agoD might not be better from the glance over it, but it's little things in it that REALLY add up. I strongly recommend anyone who ever wrote C++ code to give it a go for at least a couple of months and see for themselves. That is the best way to measure - I can only give you my sincere recommendation to try it out.
- shin_lao 17y agoIt looks great, I agree. I like the range approach for the standard library. I also like the end of the include nightmare. Is the output binary as good as a C++ one? That would be my first purely technical concern. Other concerns would be related to the building tool chain and the quality of IDEs. But the real concern is business oriented. For pet projects I'd be inclined to give a green light. It's always nice to play with new technologies as it opens your mind and give you new ideas. For full fledged commercial products you expect to live several years, that's going to be a solid red light. I wouldn't take the risk of using an unsupported language.
- Keyframe 17y ago"I like the range approach for the standard library" This is D2 - I don't use D2 and wouldn't use it. I was talking about D1/Tango combination. I don't think I'll make a switch to D2. "Is the output binary as good as a C++ one? That would be my first purely technical concern." That depends on the compiler/linker, of course. In short - dmd good enough, ldc great (llvm as the backend after all). "Other concerns would be related to the building tool chain and the quality of IDEs." You can download DMD/Tango package from their Trac page and you're ready to go, however I would strongly advise you to use SVN tango version - which implies you need MSYS(on Windows) to build it. Ask for help on forum there (dsource.org/projects/tango) or on irc d.tango (freenode). As for IDE, you can use Descent for Eclipse, as some people do. I use Emacs for everything though, same applies for D - there is a module for it. "But the real concern is business oriented." There is no concern here, since basics of risk management should tell you not to use it. Same applies for other emerging or obscure technologies as well (I'm looking at you Lisp). Short answer, don't use it for business critical things yet, though some have done that with success.
- steveklabnik 17y agoThere are two big problems with D. 1) Everyone treats D2 as being the current stable version of the language, when it isn't. 2) Tango vs Phobos when it comes to D1. But trust me, the D community is aware of those things. [1] There are a lot of tensions over the developments of D2, how they're going, etc. If and when D2 ever actually comes out, it should address lots of the issues. But you may see something sooner than that. [1] : http://www.jfbillingsley.com/blog/?p=53 http://www.jfbillingsley.com/blog/?p=53
- JulianMorrison 17y agoHaving read that blog post, I can completely and emphatically rule out using D at all for anything, unless and until I hear it's no longer a pitiable train-wreck (and I won't hold my breath).
- steveklabnik 17y agoHonestly, 99% of this doesn't matter if you're not concerned about the politics of the development of the language itself. If you code with D1, and pick a library... none of this matters. Your comment is akin to "After seeing the debacle with the C++0x committee, I will rule out C++ for anything until I hear it's no longer a train-wreck." Which might be legit. Just saying.
- blub 17y agoIt's not akin to C++/C++0x at all. C++03 is standardized and the current mainstream compilers do a good job of implementing that standard; the tools are rock-solid. C++0x is coming along nicely, with support from the big industry players. Concepts were dropped, but the rest of the features are still a massive improvement over C++03 and I can't wait to use them. On the other hand, reading that blog post about D has confirmed my worst suspicions about the instability of the language and the immaturity of the tool set.
- ponce 17y agoThere is an awful lot of problems with C++ though. - The tool are certaintly not rock solid. Parsing requires arbitrary look-ahead and semantic pass, order of headers inclusion matters, #if and dirty tricks are everywhere - compilation is slow - non standard extensions makes painful portable C++ across compilers and platform, because you need them and they can have incompatible syntax - C++ const is useless when it comes to optimization or concurrency. - any real world project involving C++ is going to be challenging if you're not working with top C++ library implementers or emasculating rules (like "no exceptions" or "nothing goes in the constructor" at Google) Anyway, even if C++1x was already here and completely supported (which C++03 is not), D would still have an edge. Despite its current problems D greatly enhance productivity over C++. Refactoring is _way_ faster when you have import and no headers to maintain. Properties enhance expressivity a lot. You have access to the machine, value semantics, and reference returns, so there is nothing conceptually wrong with it. Also, in D there is much less skill diffference between library writers and typical programmers as compared to C++. Finally if you really want C++1x features, I sincerely advises to try D because there is a lot of overlapping.
- Keyframe 17y agoD1 + Tango == yes! Excellent combo, but serious lack in the toolchain department. DMD and OPTLINK especially is a failboat currently. LDC is based on LLVM and is "the future", but lacks windows support (exceptions! and this is inherently LLVM's problem now). DDBG is a good debugger, but is unmaintained. GDC is D on GCC, but is unmaintained. D2 on the other hand doesn't feel like D anymore at all. Sure, there are a couple of nice things in it like ranges, but on the general perspective I could make this comparison: D1 is like C with C++ made right. D2 is D++, what C++ is to C - bloat and inconsistency. There is also a huuuge problem with D2 and leadership/drama, which split the community. There is also problem with Phobos vs Tango - where Tango is clearly and measurably better, but that thread of issues leads to leadership drama. Let me be clear on this (I use D every day for my projects - I am into graphics/gamedev with it). Do yourself a favor and learn D1/Tango - toolchain is bearable and there is a book about it from Apress. Community is responsive (#d, #d.tango on freenode if you demand prompt resolutions). Use Tango from SVN, use LDC or DMD if you are on Windows. Also, check out http://www.team0xf.com:1024 http://www.team0xf.com:1024 - especially dog (OpenGL platform agnostic binding) and hybrid (gui on top of it). Check out http://www.dsource.org http://www.dsource.org . There are some movements within the community that will resolve by themselves soon enough - it's too good to fall apart. In the mean time you should really do yourself a favor and give it a go.
- req2 17y agoKenta Cho, sole member of ABA Games, uses D to write his (excellent, open source, freeware) shmups. Go for the code, stay for the games: http://www.asahi-net.or.jp/~cs8k-cyu/index_e.html http://www.asahi-net.or.jp/~cs8k-cyu/index_e.html
- tree_of_item 17y agoIt doesn't seem like he uses D anymore. His last two games were written with C# and XNA.
- pornel 17y agoI've tried several times to write a project in it, and every time I found some horrible bug, something missing, broken (OSX support is poor) or libraries turned out to be useless/outdated (dsource is a graveyard), or that I've chosen the wrong set (D1 vs D2, Phobos vs Tango). I'd really like to use D, it's the non-sucky C++ I've been waiting for, but it's just far from being usable and reliable yet.
- aidenn0 17y agoOkay, I'm totally going to bite on the "find something you don't like in 30 seconds" and it's the hello world example. void main() { writeln("about to do something important"); doSomethingImportant(); } is this really not going to run doSomethingImportant() if the writeln fails? I find that to be a poor default for a systems language. This may just be a personal preference, but I strongly want a systems language to do one of 2 things: 1) Require me to explicitly state when I care about an operation failing 2) At compile time ensure that my code explicitly states when it's not going to handle an exception. (Java with this, like so many things, gets it 90% right and then falls on its face) Silently passing exceptions out to the system is a bad default for something that is supposed to be able to be used to build the system! Note that this preference does not apply for a large swath of applications programming. For a webapp, it may be reasonable to log any uncaught error conditions to a log file, since we can just signal the client to try again.
- WalterBright 17y agoUncaught exceptions are caught by the D runtime code, and the appropriate message is printed. You can declare functions as "nothrow", in which case the compiler will complain about any uncaught exceptions in the function body.
- eru 17y ago`[...] the classic "hello, world" for other languages such as Java (code omitted due to space limitations [...]'