News for hackers. Stuff that matters.
Re:The D Garbage Collector by tombert on Monday March 20, 2017 @12:12PM (#13915330)
Has anyone here done any production-level stuff with D? I'm debating using it for my next project, but I want to see if it's industry-tested.
Re:The D Garbage Collector by Ace17 on Tuesday March 21, 2017 @02:15AM (#13920232)
My company (~50 people) has been using D in production for several years. We rely on gdc (we measured it generates the fastest code for our usage).

Nearly once per year, a blocking bug sneaks into the compiler and needs to be worked-around (crashes on invalid code are easy to avoid ; sometimes, it's a little more tricky, but we've never been blocked for more than 1 day). The maintainers are very active, though, and it's generally quickly fixed, provided that I report the bug myself. There's also been some friction when it came to cross-compilation (definitely doable, but not as easy at "apt install mingw-gcc").

In the team, the adoption went well ; coming from C++, switching to D feels natural. The syntax is more concise and consistent than C++14 syntax. The standard library handles so much stuff (md5, sending emails, command line parsing, filesystem, process creation) that most of our projects don't depend on any other external library (nor do they depend on any OS-specific stuff). The fact that all variables are initialized by default makes it hard to have non-deterministic behaviour ; and the fact that the "buffer" abstraction (aka "Span"/"Slice"/"string_view"/"ptr+len") is in the language makes it really easy to write code which is concise and secure.

C++ has been slowly catching up since 2011, however, why wait?

Re:The D Garbage Collector by oripel on Monday March 20, 2017 @03:08PM (#13916787)
I do every day. It's pretty awesome, I recommend trying it. D's CTFE and templates are really really nice to use. I can write very low-level high-performance memory sensitive code, controlling everything, but the code can still be beautiful with great compiler checking. It can confuse my C++ brain sometimes, though, and then it's great to have someone to consult with (e.g on the D forums).
Re:The D Garbage Collector by glaze on Monday March 20, 2017 @03:05PM (#13916772)
Quantum Break is a modern Xbox One & PC game and uses D in some subsystems.
Re:The D Garbage Collector by swah on Monday March 20, 2017 @01:16PM (#13915885)
Most folks will say that either C++ has improved or use Rust. (D was a really lovely experience a few years ago, though..)
Re:The D Garbage Collector by p0nce on Monday March 20, 2017 @01:42PM (#13916097)
Most folks haven't tried D.
Re:The D Garbage Collector by x0x0 on Monday March 20, 2017 @03:24PM (#13916924)
Since you use it in prod / sell products written in it, could you (briefly) share why you like it and the advantages you see in it? Thank you!
Re:The D Garbage Collector by p0nce on Monday March 20, 2017 @04:41PM (#13917479)
Went from Delphi to Ocaml to lots of C++ to D. Basically I'm happier with the products I wrote in D so I keep using it. It's an almost schizophrenic language that always says "yes" when you ask if something is possible. The community regularly "discovers" new idioms within the language.

Learning D for real is as involved as any other language, but what people remark first is the low mental overhead and how absurdly practical it is.

Advantages I see would be: fast to edit, compile, and run. Non-controversial syntax, focus on power, and the fact you kind of already know it.

Re:The D Garbage Collector by int_19h on Monday March 20, 2017 @09:45PM (#13919154)
How good is the tooling? IDE support, code completion and debugging especially.
Re:The D Garbage Collector by Ace17 on Tuesday March 21, 2017 @01:54AM (#13920150)
There are 3 major compiler implementations (dmd, gdc, ldc).

I mostly work with gdc from GNU/Linux, and basically, everything that works with g++ works with gdc. More precisely, I use, on a daily basis: - vim + ctags (editor + symbol lookup) - gdb (debugger) - gcov (code coverage) - valgrind (mostly callgrind (call-graph) and massif (memory profiler)) - oprofile (cpu profiler)

Unfortunately there's no ccache equivalent yet, and I'm missing it.

For the Windows people, there's VisualD, which basically is the integration in Visual Studio. At this point, you have an IDE and a debugger (I don't know about code completion).

There's also a build-tool (with package-managing abilities), called "dub" ; that handles fetching and building external dependencies (in the vein of npm).

Re:The D Garbage Collector by int_19h on Tuesday March 21, 2017 @03:22AM (#13920409)
I'll need to check out VisualD.

Someone should do a Language Server Protocol (http://langserver.org/) implementation for D - that's clearly the way forward. Right now this will give you VSCode, Eclipse and NeoVim, with regular Vim and Emacs on the way.

VSCode also has something similar for debugging (https://code.visualstudio.com/docs/extensionAPI/api-debuggin...), but it hasn't been standardized in a similar fashion (yet?).

Re:The D Garbage Collector by p0nce on Tuesday March 21, 2017 @07:13AM (#13921205)
I use the debugger in VisualD on Windows and LDC on macOS. I guess you can also use the one in Visual Studio Code. There is ongoing work with the LSP actually, since the VSC integration uses something similar already.
Re:The D Garbage Collector by int_19h on Tuesday March 21, 2017 @04:19PM (#13925838)
BTW, I tried VisualD, and it seems that its code completion support is rudimentary. I could get it to complete functions sometimes, and I couldn't get it to complete members at all. Obviously, no refactoring either. It's unfortunate, but that would be a blocker for me.
Re:The D Garbage Collector by int_19h on Tuesday March 21, 2017 @03:24AM (#13920416)
Oh, what's the language feature parity between compilers? Are things as bad as in C++ land in that regard, or is everything reasonably close, without portability headaches when moving code between compilers?
Re:The D Garbage Collector by p0nce on Tuesday March 21, 2017 @07:10AM (#13921193)
LDC and DMD are basically at the same frontend, so it is rare to do a `version(LDC)`. GDC is a bit behind atm, but the language and library is really stable. Usually you don't change anything at all between compilers and OS. Most notable exceptions is the SIMD capabilities, and inline assembly is different on GDC. The stdlib covers a lot of ground so portability across OSes is much easier than in you-know-which-language, so small tools tend to blossom.
Re:The D Garbage Collector by systems on Monday March 20, 2017 @02:01PM (#13916259)
or use Go
Re:The D Garbage Collector by mark_element on Monday March 20, 2017 @12:14PM (#13915342)
Re:The D Garbage Collector by Cyph0n on Monday March 20, 2017 @12:17PM (#13915369)
Doesn't Facebook use D internally?
Re:The D Garbage Collector by codemac on Monday March 20, 2017 @12:25PM (#13915433)
Andrei left fb in 2015 - probably due to their lack of commitment to D & his F stocks doing well.
Re:The D Garbage Collector by bachmeier on Monday March 20, 2017 @12:32PM (#13915497)
Andrei works full time on the D language/D foundation. To my knowledge, his decision to leave Facebook had something to do with his family and his desire to work on D full time, not any problems with his employer.
Re:The D Garbage Collector by gbrown_ on Monday March 20, 2017 @12:19PM (#13915389)
They wrote a C/C++ preprocessor in D, but this now appears to be abandoned.

https://github.com/facebookarchive/warp

Re:The D Garbage Collector by Cyph0n on Monday March 20, 2017 @12:44PM (#13915597)
That's too bad. I guess OCaml is the non-mainstream language Facebook seems to be interested in.

One thing D and Nim are lacking is adoption by a large company, and I feel that's partly what's keeping them behind Go and Rust.

Re:The D Garbage Collector by vogt on Monday March 20, 2017 @07:35PM (#13918563)
Our data team at Emsi (www.economicmodeling.com) use it in production every day. We are a labor market data viz company with a multitude of different sources of data, most of which are public.
Re:The D Garbage Collector by rdnetto on Monday March 20, 2017 @09:35PM (#13919101)
I used it for a while, ended up switching to Haskell, which had a lot of similar benefits despite being so different.

If you're going to use it, I highly recommend the D Programming Language (book). It's extremely well written, and remains once of my favourite technical books.

Re:The D Garbage Collector by p0nce on Monday March 20, 2017 @03:18PM (#13916882)
You'll be okay.