
How I Came to Write D (2014) - jxub
http://www.drdobbs.com/architecture-and-design/how-i-came-to-write-d/240165322
======
WalterBright
Logged in today and saw this! Walter here, AMA!

~~~
mpweiher
Hi!

I dimly remember a fairly deep analysis/comparison of C++ and D that went into
how opaque or transparent abstractions were to the compiler, and what that
means for performance (models) and compile times.

I thought it was by you, but can no longer find it. Might you be able to point
me at it?

~~~
WalterBright
I don't recall writing such an article. It sounds intriguing, if you do find
it, I'd like to see it.

~~~
mpweiher
Sorry! I’ll keep looking.

~~~
ptrott2017
Might possibly be Andrei Alexandrescu's The Case for D -also in Dr.Dobbs.

See here: [http://www.drdobbs.com/parallel/the-case-
for-d/217801225?pgn...](http://www.drdobbs.com/parallel/the-case-
for-d/217801225?pgno=1)

------
curtis
Back when Andrei Alexandrescu was working at Facebook, I had hoped that
Facebook would adopt D as a standard language. That didn't happen, and it
seems unlikely that D will get a powerful corporate sponsor. I think that
would have greatly helped D not just in terms of resources, but also in terms
of popularity.

In an ideal world, good programming languages would win or lose on their own
merits, but that doesn't seem to be the case in the world we actually live in.

~~~
nine_k
Corporate support or not, Rust seems to be a better contender for the crown of
the sane successor to C++.

D might have been an important evolutionary step, possibly showing what _does
not_ work well for the niche it was trying to fill.

~~~
curtis
I think Rust is the clear winner for OS-level programming. I'm not at all sure
that it's the right solution for application-level programming. I think Go got
two things right for the statically compiled application-level space: Fast
compile times and garbage collection. Of course I feel like they got
everything else wrong [1], but that's what we've got in that space right now.
I think that D might be a much better fit for this space, but it doesn't
matter because Go has sucked up all the oxygen.

[1] I realize that this is not a universally held opinion, but it certainly
seems to be pretty widely held.

~~~
kqr
How does Rust have a clear hand over Ada?

~~~
jnbiche
Rust's cutting edge compiler is free, for one thing. I love Ada, but Adacore
may well have killed any chance it had of being a commercially viable language
(its use declines precipitously each year, even in the defense and avionics
industries where it used to be strong).

Plus, Rust has a thriving community whereas thanks to Adacore, Ada has a dying
one. Community is critical for programming languages.

But otherwise, Ada is a brilliant and ultra safe language whose safety
features go far beyond the memory and type safety that Rust features.

It's a shame.

~~~
pjmlp
If anything Adacore has helped Ada a lot.

It is the only Ada compiler available for free, fully updated to Ada 2012,
with all the remaining ones are still on their 90's style prices.

[https://www.ptc.com/en/products/developer-
tools/objectada](https://www.ptc.com/en/products/developer-tools/objectada)

[https://www.ghs.com/products/ada_optimizing_compilers.html](https://www.ghs.com/products/ada_optimizing_compilers.html)

[https://www.ddci.com/products_score/](https://www.ddci.com/products_score/)
(frozen in Ada 95)

Thanks to them Ada has become a regular presence at FOSDEM and is being
teached at quite a few European university.

~~~
abiox
according to wikipedia, their 'free' compiler is GPL without a linking
exception. the comparison chart on their page also says it is 'for open source
GPL software'.

~~~
pjmlp
Apparently people keep forgetting without GPL, Linux would never happened.

~~~
jnbiche
GPL for an OS is I've thing. GPL for a compiler and runtime is entirely
another, since only the latter forces any project you create with it too carry
the GPL license.

~~~
pjmlp
Ah you mean gcc, the compiler that everyone ignored until Sun started the
trend of UNIX vendors to charge for their compilers.

~~~
jnbiche
GPL's runtime isn't GPL, it's got the runtime exception:

[https://www.gnu.org/licenses/gcc-
exception-3.1.en.html](https://www.gnu.org/licenses/gcc-exception-3.1.en.html)

~~~
jnbiche
Sorry, I meant GCC's runtime isn't GPL.

------
lordnacho
I hear so many great things about D, but I haven't started coding in it yet. A
friend of mine has gotten in there, coding up his new trading platform in it.
Also virtually all his social media posts are about D, so he's keen.

Suppose I am a c++ guy who does a lot of time sensitive code. Who else has
made the leap, and what were your impressions? How often do you turn up
nothing on stackoverflow? How often do you find there's no lib where you'd
expect to have a few in c++?

~~~
qznc
There is this guy who does VST plugins in D and sells them:
[https://www.auburnsounds.com/blog/2016-02-08_Making-a-
Window...](https://www.auburnsounds.com/blog/2016-02-08_Making-a-Windows-VST-
plugin-with-D.html)

"This is a touchy topic that already has filled entire blog posts. Virtually
everyone in real-time audio is using C++ and it's probably still the sanest
choice to make. [...]

I worked with both languages for years and felt qualified enough for the
inevitable bullet point comparison. The most enabling thing is the D ecosystem
and package management through DUB, which makes messing with dependencies
basically a solved problem. Development seems to "flow" way more, and I tend
to like the end result better in a way that is undoubtedly personal."

~~~
specialist
_"...makes messing with dependencies basically a solved problem."_

Huh. Now I'm interested.

One constant in my professional (and hobby) careers has been "DLL Hell". I'd
pretty much do anything to be hassle free.

Thanks for the tip.

~~~
p0nce
On that point. In the D world there is a habit to use "derelict" bindings
which are dynamic loaders for dynlibs. This has the advantage of supporting
multiple dynlib versions, and also does not complicate the build with a
linking option... If you are making anything cross-platform it is a boon.

~~~
ByThyGrace
Can you please expand on that? Are there examples to look at of derelict
bindings?

~~~
p0nce
For example you want to depend on SDL.

You add the "derelict-sdl2" package to your DUB dependency list. DUB will
download and build that "derelict-sdl2" library. This is a small library that
will load functions pointers in the SDL2 dynlib (aka dynamic loading).

You'll still have to distribute your cross-platform app with SDL2, however
there is no linker option, the linker doesn't need to know about an import
library. Voila, same build for all platforms.

Conversely in C and C++ you would probably only have static bindings as a
choice, and it can be a pain for cross-platform builds. On Linux, it has to be
packaged. On Windows, you must find the right .lib.

There can be considerable list of libraries in linker settings, essentially
because there is no package manager that makes dependencies something
_composable_: dependencies would then leak on linker settings across the
chain. C++ forums are full of people failing to build, that's not the case
with D.

Documentation:
[http://derelictorg.github.io/loading/loader/](http://derelictorg.github.io/loading/loader/)

~~~
keldaris
How is this dynamic loading implented? Is it effectively a cross-platform
wrapper over LoadLibrary/GetProcAddress/etc. (and their POSIX equivalents) or
is there more to it? Is it possible to make link time optimization work with
dynamic loading?

~~~
CyberShadow
> Is it possible to make link time optimization work with dynamic loading?

No, but nor can you with regular ol' linking against shared libraries. Or
against static libraries (except for some mundane stuff like function
reordering). LTO requires toolchain support and occurs _before_ code
generation.

------
VHRanger
D is a great language. It simply lacks in hype like other languages in the
same space. Otherwise I find little to complain about it as a casual user

~~~
chemicalcrux
That's been my experience as well. I haven't done a great deal of work with
it, but the work I did felt very nice. It's a refreshing improvement upon
older, flawed languages...but doesn't seem to have the evangelical community
that, say, Rust has behind it.

I wonder why that is? Maybe it just needs a cooler name (:

~~~
giancarlostoro
The Dust programming language? Joke aside, I fear "D" came before Search
Engine product names were considered. Sadly sometimes I google "dlang" and
still get some odd results.

------
z3t4
D is one of the few languages that allows named scoped imports.

~~~
twic
What are those?

I don't know D, and I had a quick Google, but couldn't find anything by
exactly that name - apologies for the lazy question.

~~~
skocznymroczny
void foo() { import std.stdio; writeln("sup") }

------
wglb
Take note: _" Who the hell do you think you are thinking you can write a C
compiler?"_ If you take that challenge it will seriously elevate your computer
programming skills. In some circles, this will get you immediately hired.

Try a simple language, maybe devise an emulator to go along with it.

~~~
mlthoughts2018
> “In some circles, this will get you immediately hired.”

Is this true though? I mean Google famously didn’t give a shit about hiring
Max Howell (creator of homebrew) because of hazing-style pointless whiteboard
trivia [0].

I’d guess the number of circles where a thoughtful side project that digs into
deep computer science fundamentals as well as difficult implementation
specifics would even get you the slightest attention for an interview is close
enough to zero as to render it meaningless.

If you think about a lot of possible different self-study options, ranging
from cramming and shallow memorization of leetcode garbage or Cracking the
Coding Interview, all the way to patiently applying craftsmanship and self-
learning to a side project that exercises and demonstrates core fundamentals
in a pragmatic way, the shallow memorization garbage will earn you money,
while the side project will earn you an email with a hyperlink to HackerRank.

It is one of the worst aspects of our industry, and a major reason why I would
advise younger people to treat the idea that there are direct, stable, good-
paying jobs with job security in the tech industry with a lot of skepticism.
It’s an industry constantly trying to invent new ways to shift the
demographics more and more into the least experienced and least expensive
quantiles of candidates, and to arrange businesses where actual software labor
productivity doesn’t have a strong tie to the company’s bottom line, except
maybe for a tiny population of experts.

[0]: < [https://www.quora.com/Whats-the-logic-behind-Google-
rejectin...](https://www.quora.com/Whats-the-logic-behind-Google-rejecting-
Max-Howell-the-author-of-Homebrew-for-not-being-able-to-invert-a-binary-tree)
>

~~~
dozzie
> I mean Google famously didn’t give a shit about hiring Max Howell (creator
> of homebrew) because of hazing-style pointless whiteboard trivia [0].

People usually omit the part that Homebrew was at that point a quite shitty
reiteration of ideas well-implemented in many other places (RPM/Yum, DEB/APT,
and half a dozen other package managers). It was a common complaint that
installing one package could break several others, because Homebrew updated
some common dependency and the new one was missing symbols or had otherwise
incompatible ABI. There also was this hilarious bug report that Homebrew
served everything over plain HTTP (and Homebrew had no digital signatures
whatsoever), and the ticket got closed by a Homebrew team member saying it's
not a problem, which spoke tons about their competency in package management.

I don't know how the situation looks now, but when Howell was interviewed by
Google, Homebrew was not something you could be proud of writing.

~~~
bendmorris
>Homebrew was not something you could be proud of writing.

Anyone should be proud of writing a widely used tool that provides value to so
many individuals and companies, regardless of nitpicks from the peanut
gallery.

~~~
stephenr
Nitpicks, Glaring security issues that are design “features” and thus will
effectively never be fixed... sure those are the same thing.

------
dang
Discussed at the time:
[https://news.ycombinator.com/item?id=7555426](https://news.ycombinator.com/item?id=7555426).

------
vram22
For anyone new to and interested in D, here are a handful of command-line
utilities and other small programs written in D (on my blog), which may help
give an idea about (just some of) the kinds of things that D can do, and whet
your appetite for more:

[https://jugad2.blogspot.com/search/label/DLang](https://jugad2.blogspot.com/search/label/DLang)

A few of the posts in that sub-feed are about D videos and confs, so you can
skip past those if you want. Some of the videos are interesting too, though.

------
leshow
> The path that led Walter Bright to write a language, now among the top 20
> most used, began with curiosity — and an insult.

Is D really a top 20 language? I don't remember seeing it anywhere close to
the top 20.

[https://www.tiobe.com/tiobe-index/](https://www.tiobe.com/tiobe-index/) has
them in 31

~~~
qznc
It was at #12 in March 2009: [https://www.tiobe.com/tiobe-
index/d/](https://www.tiobe.com/tiobe-index/d/)

~~~
leshow
So it's getting less popular over time (assuming the ranking is accurate)?
That's not very felicitous.

------
jbb67
D is the language I really like, and always intend to use for my next project,
and have been saying this for the last 5 years. Every time there is something
that makes me decide to use C or C++ just one more time. I don't even think
it's mostly valid reasons.

Well I'm just about to restart an opengl project so I think I'll go
wholeheartedly into D this time

------
mathieuh
Just so you know, when I visited the article from my iPad I was prompted to
download one of those scam iPad cleaner apps.

It’s a 10” iPad Pro (maybe you can check the log and see which advertiser is
being naughty).

