47 ms·
The reference D compiler is now open source
- vram22 9y agoGood to hear the news, and congrats to all involved. Since I see some comments in this thread, asking what D can be used for, or why people should use D, I'm putting below, an Ask HN thread that I had started some months ago. It got some interesting replies: Ask HN: What are you using D (language) for? https://news.ycombinator.com/item?id=12193828 https://news.ycombinator.com/item?id=12193828
- mochomocha 9y agoToo late to the party to add my answer to your AskHN, but here we go: I use D at Netflix for machine learning backend.
- vram22 9y agoInteresting, thanks!
- WalterBright 9y agoPlease consider adding to http://dlang.org/orgs-using-d.html http://dlang.org/orgs-using-d.html
- srean 9y agoSuper interesting, could you say a little more ? Any blog posts that talk about this. From what I gathered from HN part of Adroll's ML is in D.
- WalterBright 9y agoAnd best of all, it's the Boost license! Here it is: https://github.com/dlang/dmd/pull/6680 https://github.com/dlang/dmd/pull/6680
- omginternets 9y agoWhy is this a good thing? I'm not familiar with the Boost license.
- WalterBright 9y agohttp://www.boost.org/users/license.html http://www.boost.org/users/license.html explains it better than I can.
- jacques_chirac 9y agoIt is the least encumbering, very permissive and very well regarded in both oss and corporate circles. Really a good choice to stick with it.
- WalterBright 9y agoWe liked Boost because it is "corporate lawyer approved". You can make both open and closed source derived works from it.
- hashkb 9y agoI would be careful calling it the "least encumbering"- there are definitely shorter, easier to understand licenses with fewer restrictions (i.e. zero).
- WalterBright 9y agoWe investigated public domain, but that has international legal problems with it. Boost was the best solution.
- MichaelGG 9y agoDo you have any comment son international legal issues with public domain? Is that not recognized in some places?
- JoshTriplett 9y agoInteresting change! Before, people had a choice between the proprietary Digital Mars D (dmd) compiler, or the GCC-based GDC compiler. And apparently, since the last time I looked, also the "LDC" compiler that used the already-open dmd frontend but replaced the proprietary backend with LLVM. I wonder how releasing the dmd backend as Open Source will change the balance between the various compilers, and what people will favor going forward?
- WalterBright 9y agoEach of dmd/gdc/ldc has their individual strengths and styles. It's an embarrassment of riches.
- JoshTriplett 9y ago> Each of dmd/gdc/ldc has their individual strengths and styles. I'd be really interested to hear a comparison of those from someone experienced with D and its community.
- CyberShadow 9y agoThe download page gives a brief summary: http://dlang.org/download.html http://dlang.org/download.html More information on the wiki (also linked to from the download page): https://wiki.dlang.org/Compilers https://wiki.dlang.org/Compilers
- qznc 9y agoDMD compiles really fast. At the level of Go. As the reference compiler it always has the latest features. LDC compiles to fast code and only slightly lags behind the reference. It might even catch up soon. GDC compiles to fast code and supports many architectures in theory. It lags behind the most and architecture support also requires a ported runtime.
- Ace17 9y agoProfessional D coder here. - DMD is by far the D compiler with the shortest compile time. It's actually so fast that it comes with a utility, 'rdmd', which compiles-then-execute a D program. Say goodbye to shell/perl/python scripts, now you can have compile-time checks without an explicit/slow compilation step. We use it for automation tasks. - GDC is the compiler of choice when it comes to supporting multiple targets and cross-compilation. It closely follows GCC and G++ command line conventions, meaning that using a single properly written Makefile it's easy to target x86/x86_64/arm, GNU/Linux (or Windows, but the mingw support has been in statis for years). Debian comes with pre-compiled arm-targetting GDC compiler. gdb, gcov, and operf work well. The generated code is fast (more than LDC), we use it for heavy computation tasks.
- tombert 9y agoHonestly, since I'm slightly psychotic about these things, this is a kind of huge to me. Part of the reason I never learned D was because the compiler was partly proprietary. Now I have no excuse to avoid learning the language, and that should be fun.
- nialv7 9y agoThere have been fully open source compiler for D for a long time: LDC and GDC.
- AsyncAwait 9y agoYup, but to be fair, they sometimes lack quite a bit behind dmd.
- nialv7 9y agoLDC follows dmd pretty closely nowadays. Also this doesn't make an good excuse for not learning the language.
- klickverbot 9y agoJust to clarify: LDC master is on 2.073.2 right now (the latest DMD release), with a 2.072.2-based release imminent, and work towards 2.074.0 (currently in beta) already underway. GDC is sadly a different story, though.
- AsyncAwait 9y agoI refused to touch Swift until Apple open-sourced it for the same reason :-)
- WalterBright 9y agoNo problemo - dmd works on the Mac :-)
- jordigh 9y agoWalter, thank you so much for finally doing this! I am so happy that Symantec finally listened. It must have been really frustrating to have to wait so long for this to happen. I have really been enjoying D and I love all the innovation in it. I'm really looking forward to seeing the reference compiler packaged for free operating systems. Thanks again, this news makes me very happy!
- cheez 9y agoI don't understand: I thought Walter owned the copyright, why does Symantec have anything to do with it?
- WalterBright 9y agoSymantec purchased Zortech C++, and created Symantec C++. Symantec left that business, and licensed the code to Digital Mars C++, which was later used as a basis for DMD.
- the_trapper 9y agoI remember using Symantec C++ as well. I was a teenager and on a very tight budget at the time. It was easily the best C++ IDE and compiler you could buy at the time for the price. I might have to give D a shot now just due to nostalgia.
- WalterBright 9y agoYou're welcome! It makes me happy, too. I've wanted to do this for a very long time.
- johndubchak 9y agoIn addition to your great work, Walter, Symantec really needs extra acknowledgement for the effort on their side in releasing their right to claim in order to make this happen. It seems we haven't had a lot of good things to say lately about Symantec and I hope this gives them something positive to celebrate.
- saosebastiao 9y agoThis was something that always rubbed me the wrong way about the language, and it was an impediment for adoption for me (for D, but also Shen and a few others). In this era, there is no excuse for a closed source reference compiler (I could care less if it's not a reference compiler, I just won't use it). I'm surprised it took this long to do this, it seems like D has lost most of its relevance by now...relevance it could have kept with a little more adoption. I wonder if it can recover.
- qznc 9y agoD is easier than Rust and safer than C++. That is a valuable point IMHO.
- kbenson 9y agoThere's a wide range of possibilities int that statement that include the case where you would almost always want D over Rust, and the case where you would almost never want D over Rust. The question is, how much easier is D than Rust, and how much safer is D than C++.
- WalterBright 9y agoD recently has been substantially upgraded to prevent memory corruption bugs. I'll be talking about how that works at DConf in 3 weeks.
- qznc 9y agoThere is no quantitative metric for safety and easyness. If you can afford a garbage collector, D easily wins over Rust. If you really need the safe manual memory management, Rust wins. In between is still a large grey area.
- saosebastiao 9y agoThere are plenty of reasons why Rust could win outside of requiring safe manual memory management. It is an expression based language with ad-hoc polymorphism, algebraic data types, hygienic macros, first class functions, and race-free concurrency. I don't use rust because I don't need manual memory management and I require subtype polymorphism for a lot of things, but I choose Scala over D.
- softinio 9y agoWhats special about D? why should i learn it?
- gmfawcett 9y agoExcept for perhaps Lisp languages, almost no language makes compile-time computing and code-generation so easy. This allows for some really powerful language features that can be designed as libraries, and puts this power in the hands of "regular developers" rather than only in the hands of template wizards.
- jordigh 9y agoYeah, I really love that at compile time you can meta-program in almost the same language that you use for normal run-time things. I think the comparison to lisp is apt. It almost feels like lisp macros. Think C++ template metaprogramming but much, much easier and thus, seemingly more powerful. It's not that you couldn't do the same in C++, but D's metaprogramming is so much more accessible that it makes you want to use it.
- dbcurtis 9y agoFor someone who knows zero about D, but is a total Pythonista, how would you compare the meta-programming facilities?
- jordigh 9y agoI guess the best comparison to Python would be the dunder methods. You know how in Python a class really is just a dict, right? Like, foo.bar is pretty much syntactic sugar for foo.__get_attribute__(foo.__dict__['bar']) in most cases. Or how a + b is sugar for a.__plus__(b). Well, imagine that all of the things you can do in Python by messing with dunder methods, function decorators, or metaclasses could be precomputed by a compiler and would not even execute at all during runtime. It makes everything really fast at runtime and easy to precompute at compile time.
- snackai 9y agoThis is big. Heard from mmany people that this avoids adoption.
- petre 9y agoThis is great news. I was using LDC because the DMD backend was proprietary. Thank you Walter, Andrei and whoever made this possible.
- klickverbot 9y agoWe LDC developers of course hope that you will continue to use LDC for all your non-x86 and high-performance needs. ;)
- petre 9y agoIt produces smaller binaries and it has fast compilation times. So yes, I will continue using it on x86 as well.
- zerr 9y agoAnybody worked on performance critical stuff in D? How good is its GC?
- bachmeier 9y agoI think it's common to avoid the GC in performance critical sections of your code. D's version of BLAS is faster[1] and avoids the GC completely. [1] http://blog.mir.dlang.io/glas/benchmark/openblas/2016/09/23/glas-gemm-benchmark.html http://blog.mir.dlang.io/glas/benchmark/openblas/2016/09/23/...
- openasocket 9y agoconsistently beating OpenBLAS and having performance comparable with MKL is seriously impressive. I'm wondering how that is possible. I assume it's using the same algorithms as other implementations, so the credit goes to the compiler (and to the language to some extent). But the D compiler just uses LLVM for the back end, so is this because LDC produces really good LLVM IR, or is LLVM really good at generating assembly? Either way I'm really impressed they can beat hand-tuned assembly, I'd love to see a comparison between the resulting assembly for Mir GLAS and OpenBLAS.
- bachmeier 9y agoYou can get some information from this comment[1] by the author as well as his others on that thread. This is somewhat outside of my area. [1] https://www.reddit.com/r/programming/comments/54kg6v/numeric_age_for_d_mir_glas_is_faster_than/d832t03/ https://www.reddit.com/r/programming/comments/54kg6v/numeric...
- kaleidic 9y agoIt's much easier to generate code adapted to that cpu and machine in D because of compile time features. Plus it was an excellent team of a few people working for a few years that built mir. Actually I am joking - mostly one guy working for a few months (with a little help) made mir Blas. A pretty nice example of productivity of D. Also an illustration of the high calibre of person found in the D community.
- joshsyn 9y agoPlease get rid of GC :( I want to have smart pointers instead
- qznc 9y agoNo problem, just add the @nogc annotation to your main function. int main(string[] args) @nogc { ... }
- Rusky 9y agoI haven't used D much- how much of an impact does that have when using the standard library or other libraries? Is there a good way to use things that assume a GC even when it's disabled?
- bionsuba 9y agoThere are many parts of the std lib that assume GC usage. When you mark a function as @nogc, DMD does a compile-time check and will not compile your program if there's a GC call. Applying this to main means that your entire program will by necessity be GC free.
- Rusky 9y agoRight, I understand that it effectively eliminates GC usage, I'm just wondering how much of an impact that has on what tools you have. In the extreme, I can imagine it degenerating into basically writing C, for example.
- bionsuba 9y agoYou have access to all of std.range and std.algorithm, most of std.datetime, many functions in std.string and std.digest, and others scattered throughout the std lib. The main thing you'll want to look at is std.experimental.allocator, which has tons of tools for manual memory allocation. Most of the community packages out there use the GC. Some though are transitioning to a std.experimental.allocator interface, like this containers library https://github.com/economicmodeling/containers https://github.com/economicmodeling/containers
- brakmic 9y agoPlease don't get me wrong, as I don't want to start a flame here, but why do they call D a "systems programming language" when it uses a GC? Or is it optional? I'm just reading through the docs. They do have a command line option to disable the GC but anyway...this GC thing is, imho, a no-go when it comes to systems programming. It reminds me of Go that started as a "systems programming language" too but later switched to a more realistic "networking stack". Regards,
- bachmeier 9y agoThe GC is only relevant if you allocate using the GC, because that is the only time the GC can run. If you use @nogc on your functions, you are guaranteed not to have GC allocations. You can use D as a better C with no GC but other good features. You can even avoid the D runtime compeletely if you want.
- brakmic 9y agoThanks for your helpful answer. ...and I don't understand why some people have downvoted my question. Anyway, I'll continue reading the docs :)
- bachmeier 9y agoI don't understand the downvotes either. Anyway, the docs are not that great, so Mike Parker has started a blog post series about the GC.[1] If you have questions, drop them in the d.learn forum.[2] They're pretty friendly (most of the time). [1] http://dlang.org/blog/2017/03/20/dont-fear-the-reaper/ http://dlang.org/blog/2017/03/20/dont-fear-the-reaper/ [2] https://forum.dlang.org/group/learn https://forum.dlang.org/group/learn
- mixmastamyk 9y agoDidn't downvote, but found "Please don't get me wrong, as I don't want to start a flame here, but…" redundant and slightly annoying. ;)
- asimpletune 9y ago
- iamNumber4 9y agoGood news indeed. Switched to D 4 years ago, and have never looked back. I wager that you can sit down a C++/Java/C# veteran, and say write some D code. Here's the manual, have fun. They will with in a few hours be comfortable with the language, and be fairly competent D programmer. Very little FUD surrounding the switching to yet another language with D. D's only issue is that it does not have general adoption, which I'm willing to assert is only because it's not on the forefront of the cool kids language of the week. Which is a good thing. New does not always Mean, improved. D has a historical nod to languages of the past, and is trying to improve the on strengths of C/C++ and smooth out the rough edges, and adopt more modern programming concepts. Especially with trying to be ABI compatible, it's a passing of the torch from the old guard to the new. Regardless of your thoughts on D; My opinion is I'm sold on D, It's here to stay. In 10 years D will still be in use, where as the fad languages will just be foot notes in Computer Science history as nice experiments that brought in new idea's but were just too out there in the fringes limiting themselves to the "thing/fad" of that language.
- coding123 9y agoI think a lot of languages that get popular have to have a thing. Like a thing they do well, and hopefully change the world a little... Python had math and has lots more maths now. R also has math and started to kill Python, but now Python has Tensorflow and PyTorch. Scala has Spark. Java has Tomcat, and everything that followed, which is probably 20% of the world's mass by volume. Go has Docker Ruby has/had a railroad or something? JS has well, f... I don't know where to start here. Does D have a thing?
- WalterBright 9y ago> Does D have a thing? Probably its most useful feature is rather subtle. It's very easy to express diverse ideas in code in D without having to resort to contortions. It's something people realize after having worked with D for a while. It is not the result of having feature X (you can always find feature X in other languages or a way to make X work), it's the combination of various X's. For example, some algorithms express naturally in a functional manner, some imperative, some OOP, etc. It isn't necessary to buy into a manner for the whole program, just use the manner that fits the particular part of the program. You might like to use FP here and there, but don't want to deal with monads. You can use OOP for the AST, but don't want to box integers into an OOP class. You like dynamic typing for one type, but it's a bad fit for another. You can garbage collect for a quick prototype or a seldom used part of the code, and carefully manage memory for the release or the hot spots. (The Warp preprocessor I wrote did that. https://github.com/facebookarchive/warp https://github.com/facebookarchive/warp) There's a lot less time hammering square pegs into round holes. I've seen more than enough presentations on "How To Do Technique X In Language Y" and everyone says how clever that is but the contortions are just too awful to contemplate. The flip side is that D won't be satisfying to a purist adherent of any of those paradigms.
- Samathy 9y agoAmazing! D has really been exciting me for the past couple of years. It has great potential. Hopefully a fully FOSS compiler will bring it right into the mainstream.
- sgt 9y agoOff topic question; are you related to https://en.wikipedia.org/wiki/Jacques_Chirac https://en.wikipedia.org/wiki/Jacques_Chirac ?
- bluecat 9y agoSomething I always thought was cool about dlang was that you can talk to the creator of the programming language on the forums. I don't write much D code as of now, but I always visit the forums everyday for the focused technical discussions. Anyways, congrats on the big news!
- virmundi 9y agoHas there been any new books out there to learn D? I have one that still references the Collection Wars (Phobos vs Native). Once I saw that, I put the book back on the shelf and stuck with Java.
- WalterBright 9y agohttps://wiki.dlang.org/Books https://wiki.dlang.org/Books
- tbrock 9y agoIs anyone else surprised that it wasn't before?
- jacquesm 9y agoThat is excellent news :) Congratulations Walter, now let's see D take over the world.
- WalterBright 9y agohttps://www.youtube.com/watch?v=DslPaayoB30&feature=youtu.be&t=102 https://www.youtube.com/watch?v=DslPaayoB30&feature=youtu.be...
- jacquesm 9y agoHehe. You've got my vote. Oh wait.
- deleted 9y ago[deleted]
- herickson123 9y agoI wanted to play around with D using the DMD compiler but it's unfortunate I have to install VS2013 and the Windows SDK to work with 64-bit support in Windows. I've installed VS in the past and found it to be a bloated piece of software I'm not willing to do again.
- imode 9y agowhat is it like to 'bootstrap' D? I know in many languages you can forego the standard library and 'bootstrap' yourself on small platforms (C being the main example).
- spicyponey 9y agoTremendous effort. Congrats.
- xtreak_1 9y agoThanks a lot! I am also consistently amazed at the performance of the forum like any other day even though the story is on top of HN.
- noway421 9y agoIt's really surprising that to this day, there are languages in use which have its reference implementation closed source. All the possible optimizations and collaboration possible when it's open is invaluable.
- nassyweazy 9y agoThis is an awesome news!
- petre 9y agoIs there support for BigFloat in D/phobos or any auxiliary library? I was playing around with D sequences and wrote a D program that calculates a Fibonacci sequence (iterative) with overflow detection that upgrades reals to BigInts. I wanted to also use Binet's formula which requires sqrt(5) but it only works up to n=96 or so due to floating point precision loss.
- fithisux 9y agoNo matter what people say about the applicability of Dlang, Dlang has a very bright future in science. GIS, compilers, math environments will benefit by translating to D instead of C++. D is my language of choice for this stuff.