Hacker News new | past | comments | ask | show | jobs | submit login
Moving forward with work on the D language and foundation (dlang.org)
290 points by signa11 on Aug 28, 2015 | hide | past | favorite | 130 comments



This is he. AMA!


My background was high assurance systems and security plus regular software/system development. Mainly do R&D now while evangelizing field's developments. The academic and industrial side of the field keep making great progress in transformation (see Semantic Designs), static checking (Astree Analyzer), compilation (CompCert), better optimization, and so on. The main thing that hurts such work, though, is when the language and/or its standard get too complex or vague. C++ was horrid in this regard.

So, as you try to formalize it, I encourage you to try to remove as much ambiguity and processing complexity as possible. Maybe also work with academics who specialize in formal specs or methods that caught many defects in prior language or system specs. The result is that researchers interested in building assurance and QA tools for D will have a much easier time. Just look at how long it took to certify a C compiler vs ML and LISP compilers despite latter languages being much more powerful.

Reason it's important, whether an immediate concern or not, is that much of the best stuff comes from cash- and time-strapped, but smart, academics trying to make a name or push state-of-the-art. Easier your language is to work with, the more of them might choose it. And you've done a really, good job on a C++ replacement that I thought would've had more adoption. So, I'd like to see some of those brains get put on your work, too. :)

Regardless, good luck to you on your next move!


Looks like the target audience for C++ mindshare is being taken away by Golang and Rust. When I think of "D" I think of nothing but "oh, yeah, they use it at Facebook". Who else uses it? How do you see Golang and Rust as competition?


D would be definitely helped by a large corporate sponsor. I think the foundation will make the language a more serious alternative for such adoption.

Competition is good for all involved. Rust and C++ are the competitors closer to the same turf. I think we have a solid value proposition and several ways to enhance it and differentiate ourselves. Time will tell.


We built all of our machine learning backend in D at AdRoll. Some examples:

- learning of large-scale classifiers and regressors using custom optimizers

- real-time pricing of billions of ads a day using these models on ad exchanges. <.5ms latency to parse complex bid requests and compute sparse and simd dense dot-products

- a real-time event processing system that hits DynamoDB with ~4.5K json queries per sec on a single node

We literally have D systems deployed on hundreds of ec2 instances as we speak and responsible for mission critical tasks of a >100$M run rate company. D is ready for prime time and works at scale.


And we embed D in our large-scale Erlang deployments, too.

It's a fun time.


>> D is ready for prime time

Not on ARM. I will try again but last time I tried setting up a toolchain (~6 months ago) met with headache, pain, and eventually heartache.


Thanks for sharing!


Is there a lot of C++ to go traffic ? I have not seen much along those lines. Go doesn't remotely look like a language that a C++ programmer would be interested in. Given its limitation go is an ok enough language but that's about it.


> Who else uses it?

http://wiki.dlang.org/Current_D_Use

And many more companies not in that list.


Never heard of any of them besides Facebook. Anyone famous?


Remedy and Funatics developed popular games. Though it's not said what they used "D" for.

Remedy is responsible for Alan Wake and Max Payne, Funatics for Cultures, Zanzarah, among others.


By following the links in the wiki:

Remedy: "integrating D with a typical C/C++ game engine as an extension language for use processing game logic"

Funatics: "D as a replacement for the parts of our infrastructure that use nodejs right now"


Pretty big names in their field.


Pardon my ignorance, but do you have some kind of roadmap for D ? What features do you prioritize to develop or enhance ? Will D focus on concurrency (Erlang's domain) first, RAD web app/service (PHP, Java, and Ruby's domain), or something else ?


I have quite a few things in mind for the immediate future. Organizationally, I want to get the D Language Foundation rolling as an organizational mothership of the language. Technically, I want to focus on: (a) completely defining the language - fuzzy corners such as the meaning of "shared" are a liability; (b) offer a solid experience to users who don't want a garbage collector; and (c) design more libraries using the fledgling Design by Introspection technique.

(EDIT sorry, submitted too soon) With regard to targeted users and uses, D is an ample language that could be used for a large range (heh) of applications. I want to make sure the core language and libraries offers a solid support on which various applications, frameworks, and libraries can build.


>> D is an ample language that could be used for a large range (heh) of applications. I want to make sure the core language and libraries offers a solid support on which various applications, frameworks, and libraries can build.

The advice given in marketing new products is often opposite - find a niche, offer much better value than competitors for that niche ,become the leader of that niche - and use that base to expand.

I wonder if this kind of advice offers a better route for success for a programming language ? What was the case historically ?


This is good food for thought. Yes, working through a niche has been a good "in" for some languages.


I feel this advice leaves a lot to be desired.

Ruby was around for 10 years before Rails released version 1.0. Rails itself didn't get popular until version 2, 4 years later.

It takes a long time for a language to mature to the point to where someone loves it so much they're willing to bet their career on it, as DHH did.

The best thing for a language designer to do IMO is not to try to decide what the killer app is, but rather to make it as nice as possible so that more and more people want to use it to solve problems.

Rails isn't the best web development stack because of any kind of monolithic effort on the part of the Ruby core team. It was built on top of the work of dozens of programmers who did things like write HTTP client libraries, HTML parsing tools, templating languages, all the things that a framework relies completely on.

My advice: You can only focus on so much at once. Let the community build the tools. You build the language. You'll never be able to do both, there just isn't enough time.

There's so much other stuff for you to do. Figure out governance, setting a tone for the community, reaching out to heavyweights so as to raise your profile, working out what your relationship to corporate sponsors is, how you're going to ensure stability across versions, package management. The countless little things that make one language more of a joy to work with than another.


I'm pretty sure there's a market for D on consoles and mobile gaming. This is the first thing I get asked every time I suggest using D at work (we mainly do casual games while also porting AAA titles with a few internal engines).

So far I've only been successful with a few shell scripts calling into the tools of the console's SDK doing mass reflection on 75k shader object files among other things. Yet I do half of my home projects in D and absolutely love it.

I think getting D to interopt with more existing code in all of C#, Java and Objective-C as well as on both mobile devices and game consoles will greatly help its adoption with the "oh its just another library we add to our existing codebase" factor which has tremendously helped Clojure take off.

This means D could make it easy to extend both JVM and CLR applications with lighting fast code while getting free access to their respective ecosystems. I for one would love to use D instead of C# to write Unity code.


Clojure isn't really a fair comparison. Clojure hasn't got low-level interop with all those things, just JVM, and that interop is bought at the cost of closely tying Clojure to JVM. I don't think D can be changed in all the basic ways that would be required to give it the same level of integration with JVM, and that would also basically mean abandoning the entire standard library. JVM's difficulties integrating with things other than JVM aren't something I imagine D can really solve.


I meant things such as extern(C#) and extern(Java) to work the same way extern(C) and extern(C++) do now.

I don't see the point of compiling D to JVM or CLR byte-code for all the efforts it would involve, but rather the CLR or JVM load native code written in D and have each call into each other easily.

Say I can't reach the performance I want in C# and I want to write that part of the system in D and load it in Unity and then call into native D code from there. Without having to mess with the CLR implementation details. That would definitely allow people to try it out and integrate it gradually until it has completely taken over.


1. I read you were rewriting the GC, is that still on track?

2. is there any plan to include Mobile(mainly iOS/Android) in the D roadmap?

3. any plans to safely use the standard library with GC disabled?


1. I got std.experimental.allocator accepted for inclusion. On its basis it's not difficult to build the structures and algorithms necessary for garbage collection.

However, there were two concurrent developments. One is Martin Nowak and others did great work on improving D's existing garbage collector. The other trend is that it became increasingly clear that a category of users will always be weary of a GC, be it for the right or wrong reasons. So the better place to hit is to offer a great experience in D without requiring any garbage collection at all.

2. Mobile is an important area for a language like D. We don't have many experts on team to work on that, but we're looking. One thing I can do soon is to encourage ARM support, which right now works only experimentally and in a science project kind of way.

3. I want to make it possible to use a well-defined subset of the standard library without a GC. (The subset part is for legacy compatibility.)


Mult succes in continuare ! :)


Multzam!


My question: Why? I mean, why this decision for your personal career?


I want to work on something where I can make a difference, and I think this is it. Paul Graham wrote (paraphrased from http://www.paulgraham.com/procrastination.html) one should at best work on things likely to be part of one's obituary. At this point I feel there'd be little difference if my obituary read "worked for 6 years at Facebook" vs. 7, 8 etc. But if I helped people get code written better, that's a lure I wasn't willing to not seize.


I followed D for sometime, it has taken all the good parts from other languages in an incremental manner - contracts / actors/ functional concepts.

Do you vision D becoming a transpiler platform, similar to JavaScript land where languages target D source ?

x-lang => D => ldc => binary


Probably not; D is not a particularly suited language for being a backend target. To be fair, neither is Javascript; it got in that position by accident.

That said, just as a related aside, there's the Daniel Murphy's magicport program that translates real projects from C++ do D semiautomatically (Daniel used it to translate the D compiler itself; we recently committed to bootstrapping).


Could you please elaborate on why D is not a good backend language? Knowing the little I know about it, I assumed that would be a good start for it.


I fixed a bug in Flint; do you have an equivalent of the Knuth $2.56 check?

On a serious note... what do you think you will miss the most about Facebook?


The income :o). Well, just kidding. I think the best thing about Facebook is its people. They are really really good, and that's felt at all levels.


Whats the status of std.stream?


I think the lack of demand for it has been an indicator that ranges with additions are just enough. We're currently looking at adding optional primitives to ranges in a Design by Introspection manner to support bulk streaming of data.


I would definitely love to see range primitives support bulk streaming!

How about adding a byte buffer concept alongside with ranges? I'm thinking an API similar to Netty's ByteBuf but using D's compile-time capabilities instead. These would be valid ranges as well but offer direct byte access on top.


Also, while on the subject of status updates, what's the status of std.reflection? Any chance UDAs could be included in there? :)

It would be great if the reflection info could be outputted to a separate file for those cases where its only needed during program initialization or used by external tools.


Not AA, but streams have been pretty much deprecated in favor of ranges.


Aren't ranges and streams conceptually different? Ranges are for data traversals and streams are for data transfers.

I want more than empty, front and popFront to manipulate byte buffers with high performance.

I'm thinking about reading data structures, performing bit conversion, and extracting primitive values from untyped byte arrays. Going as far as to reuse the array's memory for the values being read which isn't possible with ranges.


Awesome, and congrats to AA! We have an all out languages war ahead with D vs. Rust vs Go. I'm sure tons of innovations will come out of this that will benefit us all!

(Yeah, I get it that the languages target different niches in theory, but there will be significant overlap among the people who use them, I'm sure...)


D, Rust, and Go (and C++) have been on stage together: https://www.youtube.com/watch?v=BBbv1ej0fFo


Ouch, quite a difference between the founders... now I'm sure that C++ and Go will rule the world... unfortunately.

D would be awesome for game development, because it's a "C++ done right", but I don't think Andrei has the salesman qualities needed to sell his child to game devs, like getting a bunch of people together to write a good open-source game engine that could also serve as an example of codding patterns.

And Rust and his daddy... they are just too smart to become popular nowadays, people just don't have the will and time to sit and learn better ways of doing things when they have alternatives that "mostly work most of the time" and have an easier learning curve...


> And Rust and his daddy... they are just too smart to become popular nowadays, people just don't have the will and time to sit and learn better ways of doing things when they have alternatives that "mostly work most of the time" and have an easier learning curve...

That presupposes that Rust is more complex than C++ in a way that causes developers to learn C++ instead of Rust. Certainly there are a lot of C++ developers at the moment (though that number is much less than in years and decades past!) But I don't see that many new developers learning C++ anymore. Even beginning programmers who are interested in games are turning to higher-level languages and frameworks these days. My employer hires lots of C++ developers, and it's well-known that it's getting increasingly harder to find them.

When comparing Rust to Go, sure, Go is an easier language to pick up. When comparing Rust to C++, the majority of people I've talked to think the ease of use advantage goes to Rust.


I actually got the impression that the C++ and Go camps were pretty happy to see the competition and conversation. Those 4 languages are a pretty good cross section of the state of "systems programming" and I don't think any of them really feel that there isn't room, in the near future at least, for all of their offerings.

I think D and Rust will both be fairly well received (if they aren't already), if only for their perspective on memory management.

Andrei hopefully doesn't need salesman like qualities. I hope that there will be enough D evangelists to do the selling for him.

Rust will hopefully be hugely successful, but if not, the ideas it espoused will certainly be developed further by future languages.

Those 4 languages are aiming at different targets (I think Rust and D would be aiming at the most common group). C++ is looking to gain the ability to do "modern things" in C++ without confusing existing C++ devs, Go is looking to attract devs who want to do modern stuff with a tiny ramp-up cost (low cognitive over-head, low time-to-productivity, brilliant standard library, native concurrency primitives) whereas D and Rust are both offering languages with more "modern" features that may be theoretically sound, but don't have as much proven use in production code.

These differences are blurred, and the languages obviously do have cross-over in terms of features and paradigms, but I doubt they're truly competing for many jobs yet.

They all have their place, depending on what you're trying to achieve.


Game devs tired of C++ are waiting for Jonathan Blow's new language :) https://www.youtube.com/watch?v=TH9VCN6UkyQ

He states D isn't different enough to encourage most devs to go through the pain of switching. If they are going to switch, they would like that language to be much better targeted at solving game dev specific needs.


D happened at the wrong time. It was a better C++ that nobody really asked for at a time when java and C# were the future. When some years later that surprising wave of alternative languages for CLR and the JVM arrived and opened the door wide for other languages as well, D was already stigmatized as the better C++ that did not make it.

I also think that, due to it's early start, D simply fails to appeal to non-C++-developers. The other new native compiled languages, Go and Rust, are not just a new toy for C++ people, but are also seen as long awaited "on metal" opportunities for people from other language backgrounds (python and ruby for go, type-heavy managed languages for rust), who would never touch c++ or, guilty by association, D. This is a much bigger audience than the subset of c++ devs willing to give up their hard-earned mastery of c++. The perceived promise of native for high-level devs might not hold, but this won't help D at all.


Go is not "on metal" (garbage collector). Rust and D are. D has that nice introspection, it still can be better C++ than C++. The critical point is to make that as easy as possible for the existing code bases.


D is the only language I know which at least tries to provide C++ interop (without going through the C ABI). Being syntactically and semantically closer to C++ is an advantage here. This is probably the biggest promise D has for game developers. However, it is not production ready yet.


Game devs will 'never' switch to D or anything different from C++, it's a standard in the industry for the past 20 years, everything is built around it.

Edit: yeay the downvote bandwagon, you should go to a AAA studio and ask about C++.


Never say never. I am a game dev. I worked on AAA titles. I want to switch to D. Badly.

There are reasons why AAA studios stick to C++: they don't know any better, they're in constant crunch-mode and don't have time to look for better alternatives, they use an existing engine with years of development history and don't want to invest in a new one, they target platforms where only C/C++ compilers are available, etc.

You'd be surprised of the horrors you can find in a game's C++ code base (there are gems too, but you kind of expect those.)


You'd be surprised of the horrors you can find in a game's C++ code base

While it's true that some languages make some horrors easier to bring into the world (if you take away people's access to the memory, for example, you remove an entire class of memory-related nightmares), in my experience, the key requirement for creating these horrors isn't the language; it's the programmer and the constraints they're working under (such things as inexperience, painful levels of urgency, inappropriate processes, team churn, and so on and so on). People can and will make horrors in any language, and if D becomes the new C++, in twenty years people will be saying the same things about D.


While I agree with you I think D's design avoid a lot of the pitfalls of C++.

When I think about all the different variable initialization rules in C++ I know I'll get it wrong in crunch time and most likely get it wrong when all my work conditions are perfect because there's like 7 different rules. And that's for one feature only.

D doesn't make it impossible to write horrors, it just doesn't ask for it the way C++ does.


Not sure why you're getting down voted. The middleware business is dominated by C++, Windows is still the big player, and pretty much all legacy code is written in C++. Adopting new language features is far more practical than moving to another language.

Relatively small backend apps written in C++ may be a better target for D and Rust.


Everyone that has been related to the game industry since the early days, knows game studios also change languages, despite the existing eco-systems.

The difference is that they only do it when the OS vendors, or game console vendors, force them to adopt new languages in their SDKs.


I don't know if it will be D, but I am 100% sure they will change.

First there was only Assembly, C and Pascal dialects were dog slow, and the OS vendors forced them to go C.

Then there was only C, C++ was dog slow, and the OS vendors forced them to go C++.

Then there was only C++, language X was dog slow, and the OS vendors force them to go language X.

The question is what language X stands for.


Tim Sweeney (Epic Games) gave a great presentation about programming languages and game development, with examples from the Unreal Engine (e.g. "90% of integer variables in Unreal exist to index into arrays.").

https://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced...


No, but fortunately (in this rare case), people also tend to... uhm... you know... after a certain age (or sooner, after too many energy drinks and sleepless nights) ...die :)

And the new generation usually comes with a fresh set of ideas about things, and some of the newbloods will be "stupid" enough to start and rewrite some of the C++ tools, at the expense of their employers that will see delayed projects and tons of bugs because of this, and probably fire the trouble-makers, but the retooling will happen anyway, so it's probably better for people to embrace it and start allocating budget slices for it.


The game industry isn't just AAA(arguably AAA died a while ago).

I know many gamdevs using Unity, LUA, Javascript, Gamemaker and a ton of other options.


funny, every time someone says they're sick of C++ all i see in their code samples is horrible C with classes code.

take for example a lot of C++ samples that that guy shows in the video, he calls it "C++11" and uses code like:

- void* data = NULL;

- no STL

- no stack allocations

- only dynamic memory allocation using new and delete

i mean come on..


Almost every AAA game I've seen didn't use the STL. Boost is a definite no-go for most studios.

Stack allocations are discouraged because they can introduce non-deterministic bugs (stack overflow depending on the call sequence which can't be predicted in advance).

Its nearly impossible to write a game without dynamic allocations. Most of the time they'll override the new/delete operators and on that level they work almost exclusively on void*.

You're working on a scale where a lot of the C++ features work against you.


- "Almost every AAA game I've seen didn't use the STL."

that’s probably because most of the AAA games you've seen used old in-house libraries that replaced the STL, since the earlier STL implementations weren't the best.

STL is not 100% the way to go every time, but i would say that nowadays unless there’s a really specific implementation need, it should be used at least 90% of the times, even if only for base for new data structures to be built on top of.

- "Stack allocations are discouraged because they can introduce non-deterministic bugs (stack overflow depending on the call sequence which can't be predicted in advance)."

i really don’t understand this problem, you can change the stack size on every compiler and every OS either on compile time or runtime. also, are you writing functions or methods with 10k LoC?

stack allocations are actually easier to follow than heap, its not even close..

- "Its nearly impossible to write a game without dynamic allocations. Most of the time they'll override the new/delete operators"

yes i agree, dynamic allocations are still really needed, and not only for games.

But, overriding new / delete operators in C++ when you can set custom allocators and deallocators for both unique_ptr and shared_ptr? once again i think that’s more of a legacy code update problem than an actually implementation need problem.

- "and on that level they work almost exclusively on void*."

only if they want to, that’s what templates (and again the STL) are here for.

I’m not saying pure C++11/14 features are the only way to go, i just think that at least in new code it should take priority, the cleanness and robustness it provides its just too good to ignore.


You arguably don't need that many data structures in a game engine, almost everything is tightly packed in linear arrays. Even hash-maps are frowned upon. The single most used structure I've seen in engines is the plain old array because of cache locality. Everything is pre-sorted, pre-looked-up and pre-crunched so the main use-case is a straightforward linear traversal with as little branches as possible. Also templates can greatly affect compilation times which are already horrible on projects of such magnitude.

On the last AAA game I worked on we had very tight memory constraints and running about a dozen threads. Almost all of them used the minimum stack size except for the main thread. There were still a lot of stack allocations, but only for very small temporary objects and when the call stack was known to be shallow. Using megabytes for stack sizes would consume a noticeable percentage of the available memory which was direly needed elsewhere.

I've seen one game using shared_ptr and it was far from being great. There's a big overhead to it when compared to custom allocators. You can't easily optimize for cache locality with shared_ptr (as far as I know!) and working around enable_shared_from_this can be a real pain. With custom allocators you can easily optimize according to the use-cases.

Finally, templates are required to know their type at compile time, which for things like allocators is just not possible in many cases. For example, we used a bump-the-pointer allocator for a frame's temporary values which could be of any type but still needed cache locality. We also used a fixed-size allocator when avoiding memory fragmentation was more important than cache locality. Both would be impossible to do on anything but void*.


Ah man, fond memories of game dev. That's the way you write high performance C/C++.

I haven't taken the time to dig into seeing how these techniques will translate to Rust(obviously unsafe).


I haven't tried Rust yet, but they all easily translate into D!

I've lost count of the number of times I've thought to myself "I wish C++ has this D feature." A lot of them are being added now but the interesting ones (concepts!) are still years away and some (inout functions!) are nowhere in sight.

And then there's templates, mixins, auto this, compile-time reflection, and so much more. Its far from perfect (nothing is) but constantly improving and rather productive. Of course also being a user of Clojure (and Emacs-LISP) I sometimes miss something like defmacro, which I can almost get with mixins and templates but often not as elegantly. On the other hand, I write shell scripts in D all the time and not in Clojure!


Did they ever fix the memory release semantics with std::vector?

Last time I looked std::vector::clear() wasn't required to release memory and caused a lot of headache when certain implementations wouldn't free the underlying memory.

I'm aware that the work around is to assign a new std::vector<T>() but that always felt like more of a hack then anything else.


this is a reply to vvanders comment, for some reason i cant reply directly to his comment, so ill reply to myself..

they didn’t really "fix" it, instead they added a method called std::vector<T>::shrink_to_fit() which i'll admit its not the most elegant way, but it works.

what it does is, it resizes the capacity() to be the same as the size(), deallocating all the extra memory.


About the reply issue: its simply HN's mechanism to prevent flamewars from escalading quickly. The deeper a comment is the longer you have to wait after it is posted to be able to reply to it.


possibly they're using C with classes because they're sick of C++?


Thanks! You made me google Jonathan Blow and his language again (I've listened to his talk about a new language for game development some time ago, and I really like his thoughts on game design), and came across this on Jai's page https://sites.google.com/site/jailanguageprimer/ :

"Abstractions like RAII, constructors and destructors, polymorphism, and exceptions were invented with the intention of solving problems that game programmers don’t have, and with the result of interfering with the solutions to problems that game programmers do have."

...that's basically enough to make me never bother to look him up again. We don't need more special purpose languages, we need more general purpose ones. That's the cool thing about D and Rust and Go too. You can easily use the same language for anything from simple scripts (D even has rdmd that basically works like a ruby/python-style interpreter to run a file without even compiling!) to, I don't know, navigation control code for a drone.

We really don't need more special purpose tools now, the hardware allows us to have languages that span the full spectrum from metal to web page (via compile-to-js, but still...), so let's use this. Yeah, full-spectrum languages will be neither C-like (like close enough to metal so you can see the resulting machine code in your head) nor Javascript-like (idiot-friendly but professional-hostile), so we should prepare for some "weirdness".

It's not like we don't already know that this is possible since like 30 years ago: Lisp machines used one high level language for everything from OS to GUIs but and it worked great, with the exception that their price/performance ratio was horrible, but now we kind of solved the problem of building dirt-cheap machines, so we can get back to dreaming awesome stuff! And in the games world, I think that John Carmack has partially "seen the light" too, and maybe he'll convince more people of what he's seen ;)


Assuming that a special-purpose tool services a given need better than a general-purpose tool, the only reason to prefer the general tool is because the market for that service may not be sufficiently large to bear the cost of supporting a specialized tool. But in a niche whose market is perpetually growing, the preferred tools will become more and more specialized over time and sticking with a general solution will become less and less competitive. A shrinking market may experience the opposite effect. Regardless of whether Jai is a useful tool, the question of whether to pursue specialized tools for game development depends on where you see market demand for those tools heading in the next decade.


I wouldn't discount Rust, I'm finding it incredibly refreshing after spending most of my career in C++.


Rust has at least one niche for itself: Extension language for Python (or Javascript, Ruby, etc). A language with garbage collection disqualifies because Python already has one and two GCs in one application is not a good idea. Go has no plans to abandon GC and D still has a long way to go.


I've seen quite a bit of interest from hobby gamedev people in rust, way more than in D. I think reddit has had a rust gamedev sub for quite a while. Now if hobbyist/indie interest will influence the industry at large is a different matter, but I wouldn't count Rust out just yet.


> I think reddit has had a rust gamedev sub for quite a while.

https://www.reddit.com/r/rust_gamedev it's pretty small though (1264 subscribers, /r/rust has 12000, /r/swift is the same and /r/golang has 16000)


That's actually quite impressive for such a niche subreddit.


It's almost as /r/d_language


that's an impressive lineup. (flame bait: which one would fix your mem leak for you? I think AA, he seems pretty cool..)


I wouldn't say it's a language war :) The communities of D, C++ and Rust seem quite civil.


One of the first things I'm looking at in Go and Rust is compatibility with C. I haven't used D, but this page makes it look as good or better from that perspective:

http://dlang.org/interfaceToC.html

Can anyone comment further?


It seems Rust and D have very very similar C FFIs, see http://doc.rust-lang.org/book/ffi.html .

https://github.com/crabtw/rust-bindgen is a tool in the vein of dstep.

(Rust has the advantage of having no runtime beyond what C needs unlike D with its current garbage collector, so FFI, especially exposing a C interface, is likely somewhat simpler.)


I can. I've written D interfaces to vendor-supplied C and C++ SDKs and for an open source C library (libusb). We're using this at work. For C, it's relatively easy and mechanical to translate by hand but https://github.com/jacob-carlborg/dstep makes starting trivial. For C++, I had two cases- one was easy as that vendor provided a C handle and function call syntax while the other required doing a C shim (facade) to wrap up the object. I didn't find SWIG to be useful but did examine its output to get ideas. The built-in unit testing in D is very handy.


I have looked at D repeatedly over the last couple of years, and I really hope it will become more popular.

It looks pretty much like what one would want C++ to be like if one were to start over again, free of the need for backwards compatilibity with C (at the syntax level)

I haven't had the A-Ha moment with D, I have to admit, not the way I had with Go. Right now, Go feels more aligned with the way I tend to think.

But I still think that D is a brilliant language that people will come to like if they are not tied to the ground by legacy code they have to maintain. I don't think D will ever replace C++, but if Alexandrescu is behind it, that might go a long way.


Try programming with (std.)ranges and (std.)algorithm's. It's something completely refreshing, replacing a mess of loopy code with a clean pipeline of algorithms. The lazy nature of the standard algorithms and the clean syntax you get with the UFCS feature produce some really neat results. Even if you end up not using D any further, it can change your view of programming.


Yeah, it's a lot like lisp in that regard. I'm glad I learned D even though I don't use it professionally if only because it changed the way I look at some things. The algorithm chaining enabled by UFCS and the range based standard library can lead to some very beautiful code (at least as far as C-family languages go). It also made me painfully aware of how often I copy strings in C++ (string_view cannot come soon enough).

Here's a snippet of code I hacked together in D for a bot to scrape titles from pages of urls in irc messages.

    matchAll(message, re_url)
              .map!(      match => match.captures[0] )
              .map!(        url => getFirst4k(url).ifThrown([]) )
              .map!(    content => matchFirst(cast(char[])content, re_title) )
              .cache // cache to prevent multiple evaluations of preceding
              .filter!( capture => !capture.empty )
              .map!(    capture => capture[1].idup.entitiesToUnicode )
              .map!(  uni_title => uni_title.replaceAll(re_ws, " ") )
              .array
              .ifThrown([]);
It uses D's fast compile-time regex engine to look for URLs, then it downloads the first 4k (or substitutes an empty array if there was an exception), uses regex again to look for a title, filters out any that didn't find a title, converts all the html entities to their unicode equivalents (another function I wrote), replaces excessive whitespace using regex, then returns all the titles it found (or an empty array if there was an exception). There's stuff to improve upon but compared to how I would approach it in C++ it's much nicer.


This looks pretty cool! I think I know what I am going to do over my next vacation! :)


great times ahead for D!

for those now interested in the D language one must recommend Ali Çehreli's free book that now is also available as print:

http://ddili.org/ders/d.en/index.html


What a bold move. There are other in the OS communities, languages guru's that are working 100% on the language?

Matz is working only on ruby at heroku? Guido, is working full time at dropbox?

I think this is huge lose for Facebook and a big win for D lang comunity


The question on my mind (and probably everybody else's) is Facebook backing away from D? Seems like if they were stepping up D, they would want to keep him on board to help improve it. And backing away from D might have encouraged him to leave.


Anything is possible (crystal balls are notoriously unreliable), but in the linked forum, Mr. Alexandrescu says Facebook is not backing away from D:

"Facebook is and continues to be a D user, the last project I was working on (and is ongoing) uses D, and there's more use in smaller internal projects. But there is no stronger involvement for the time being."

http://forum.dlang.org/post/qnfbjzpldfhqsfqclqdx@forum.dlang...


FaceBook has Simon Marlow working haskell though it seems he's mostly working on the library side of the things see[1].

1: https://github.com/facebook/Haxl


I was pleasantly surprised to see that David Abrahams (Boost / C++) was working on Swift's Standard Library at Apple.


Don't miss to click around a little (but probably not too much) on the D forum. It's super fast, but also somewhat annoying (at least in chrome) since it flashes when reloading. Is there a write up somewhere of the stack (etc.) behind it?



thanks, this is super impressive


I'm amazed by how well it holds up despite being both #1 on HN and /r/programming (twice, in the latter case).


As a mostly-non-programmer who doesn't know anything about D/Go/Rust, that's my favorite thing about D, is the web page :)

To my memory it's basically generated static content. That's why it handles high load with such grace, and is so fast even on the slowest devices. I don't know the complexities behind that, but damn, I wish more sites did it.


Somehow I find this more inspiring than most commercial success stories. Deciding to work on ideas instead of working for a large or small company. I sincerely wish the best to the D Foundation.

(I'm an occasional lurker on D mailing list and proud owner of the D book. That mailing list, BTW, taught me a great deal of things about a whole bunch of programming languages.)


Well, this looks like interesting times ahead for the D language. Hopefully this is a good thing, I've loved D since I first came across it. :)


That is an incredible loss for Facebook. Congratulations to the D foundation and community though!


I remember reading this book when I was using C++ a lot and being blown away:

http://www.amazon.com/Modern-Design-Generic-Programming-Patt...

Unfortunately - I changed jobs to work on some start ups and said bye to C++ for Python, JS, etc and never had a chance to really use the concepts


I want to learn D, Rust, Go, Android, Rails 4.x, Objective C/Ios, D3.js, C++11, Lisp, Smalltalk.... Good luck with that, me.


I can't even get enough time to do Nim, Ember 2, and Rails 5.


What activities are running to get some more infrastructure support for D. I keep tryimg to bring up a workflow on it, but get hit by a lack of support for things like editors/ide's and package managers.

Will the foundatiom be sponsoring development of plugins for popular ide's like atom, netbeans, intelij, eclipse etc.


This is indeed a very courageous decision on AA's part to leave a secure job at Facebook to join D Foundation. But I am pretty sure, if at some point in future AA decides, FB will be very happy to have him back.


AA is a rockstar programmer, I'd imagine he isn't too short on cash and wouldn't have any problem finding a job in a big company if he decides to.


I started learning D in 2012, coming from a Java/C++ background. One thing that I've learned over the past 3 years is that D is one of those languages that completely changes your perspective on some aspect of language design (for D, that's metaprogramming and range-based algorithms). D can proudly take its place among the Lisps, the Haskells, the Smalltalks, as one of those fundamental paradigm shifts that makes you think differently about everyday problems.


I know a little JavaScript - what's the best way for me to tinker around with D and see what it offers? I'm curious!

Even if I just built something simple in both languages it would be a fun exercise.


It's a bit old, but this gives some nice context and allows you to follow along with your own D compiler:

http://www.informit.com/articles/article.aspx?p=1381876


Good luck! I have been wishing D well for many years now and I hope your steering of the foundation will take D into the forefront of programming.


nit:

"Next step with the D Language Foundation is a formal talk with the foundation's prospective attorney tomorrow."

Isn't that something you'd like to do before leaving your day job?


Off topic and old but does anyone on here know what happened to the c++ ranges implementation he promised?


Do you mean Eric Niebler's ranges[1] library?

[1]https://github.com/ericniebler/range-v3


I meant this

https://news.ycombinator.com/item?id=716111

I think he said he had an implementation almost ready to release but I never saw it. I would be very interested to see it. Thought it would be a good thread to ask.


Of course if you don't know who Alexandrescu is, here is a C++ fantasy map that was circulated a few years back (it is funnier if know C++) and well, Alexandrescu has his own castle there:

http://goldns.ru/cppmap-2012.png


I heard that there's also a diamond mine somewhere in the multiple inheritance forest, but all pointers to its exact location seem to be off a bit :)


Indeed, look West, there is a diamond mine. By the Virtual Inheritance Mountains, which are North of the Inheritance Forest. The location makes sense, because virtual inheritance helps solve the "diamond" problem. (I am not a good C++ programmer, so if this is wrong, please correct me).


That's for explaining the joke so laboriously and with so little wit


"concepts shipwreck"

it makes me sad :(


Just curious, what happened with concepts? I have a moderate amount of C++ knowledge, and have heard of concepts, but nothing more.


They couldn't make it into the official C++11 standard. Seems like the standards committee still wants to add them, but it's not clear when that would happen.


Concepts lite has already passed the vote for for C++17.


Awesome, I didn't know that!


And just over there in the ocean is his ship, Loki.


"STL" inside the holy standard lands! I protest! The standard recognises no such thing as "STL"! It is simply the standard libary. The STL is the library that <strike>Alexandrescu</strike> Stepanov wrote that precedes the C++ stdlib.


Alexander Stepanov wrote it.


It's location has meaning - it's right on the edge of the known lands.


Shitty move by Facebook not at least partially sponsoring this. Instead, they keep putting lipstick on their PHP pig.


the pig flies pretty well for them...


while HHVM has a little bit of popularity I don't think Hack is really popular. But good for them if it works.


Well it doesn't play with basically any library. That goes for HHVM as well. I tried it out after someone here recommended it. I had about the simplest app possible and I still couldn't get it to build.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: