Introduction to Dlang [video]
Good talk Ali. All these talks are for people who create small, standalone programs and tools.<p>For history, I hated D back in 2006&#x2F;7. But post Andrei joining D was fantastic. It was very easy to jump into D&#x27;s standard library and understand it&#x27;s inner workings. Over those years I created and maintained apps, services and microservices written in D. It was pleasure writing programs in D. Its compile time features make it pleasurable to write algorithms and refactor at ease.<p>But it was horribly painful to debug production issues. GC crashes day in and day out. Missing ecosystem of libraries and tools. vibe-d was unstable, so we had to create our own HTTP2 library. There&#x27;s very little tooling to figure out what&#x27;s going on when things go wrong. Templates in D are awesome for compile time, but it&#x27;s the opposite case with GC and runtime.<p>D&#x27;s built in attributes are like family members who don&#x27;t like each other but are trying to live in a single room. What else do you expect of such programs? You try to observe&#x2F;log from your transport layer, but when you get deep into BetterC layer, you can&#x27;t use loggers as they use GC. OK, write your own nogc logger, but that doesn&#x27;t work well with default logger. The cycle repeats for every single attribute and every single behavior during runtime. It&#x27;s just a mess.<p>Until I read the source code of Rust standard library a year or so ago. It was not as pleasant as D, but it was easy to understand and pickup the language.<p>I switched jobs a year ago and instructed our teams to experiment with Rust even though I had decades of expertise with C++ and a decade with D. The immediate benefit we saw was Rust&#x27;s opinionated error handling, which proved to be the right approach to most of common programming mistakes. We started using Tokio and all praises to it. No going back!<p>Personally, I can ask my teams to use D when it has all the sane defaults of Rust and a good ecosystem. Otherwise it is way too expensive to maintain as there&#x27;s no benefit of portability as well. We now write all code in Rust and ship it across different platforms seamlessly, including Android, iOS, Windows, Linux and macOS. One language and code to rule them all.<p>Few recommendations to @WalterBright as he is on HN.<p>Personal recommendations:
1. You created D because you felt the pain of the C++ programmers. Appreciate it and thank you for that. Over the years you&#x27;ve built up &quot;the curse of knowledge bias&quot; with D. Start using D as a new programmer to the language and the ecosystem. Come out of your MicroEMACS shell and use a modern editor&#x2F;IDE like VSCode and see how lacking the tooling is. WebFreak has done an amazing job with code-d[1]. But it is in no competition to Rust&#x27;s IDE support.
2. Use <i>all the features</i> of D in a non-compiler, long running, real life ML&#x2F;microservices project. You will see the pains of GC.
3. Unit testing != assert
4. Scoped exit != RAII<p>General recommendation: SWITCH TO SANE DEFAULTS!
1. @safe by default. Allow hiding all C interfaces under @unsafe. Retire once for all @trusted&#x2F;@system. @safe =&gt; @unsafe
2. BetterC by default
3. Immutable&#x2F;const by default
4. @nogc by default. That is @nogc =&gt; @gc
5. Rust like opinionated error handling and remove exceptions. At least make nothrow default and introduce throw.
7. Reduce the attribute bloat: <a href="https:&#x2F;&#x2F;dlang.org&#x2F;spec&#x2F;attribute.html" rel="nofollow">https:&#x2F;&#x2F;dlang.org&#x2F;spec&#x2F;attribute.html</a><p>Feedback to D community from learnings in Rust community:
1. Learn to work on team projects to improve D ecosystem instead of shitty ideas about &quot;Signatures&quot;, etc.
2. DIP1000 for safety is open for like 7 years and has no conclusion and still NOBODY cares. Just saying that D is alive and community is awesome are just a jokes. D has lost it&#x27;s &quot;brains&quot; and there are just a few hanging around at the moment, unfortunately.
3. There&#x27;s not even a standard dfmt template for Phobos&#x2F;Druntime. Bring one and you will possibly gain contributors.<p>Yes, Rust code doesn&#x27;t look elegant with littered angle brackets and &amp;&#x27; across the code base, no templates, makes programmers life difficult, etc. But we can live with all that and still have peaceful nights (and weekends) without calls from production support, when compared to downtimes due to half baked features in D (I didn&#x27;t mention about @live in preview yet).<p>In the end, a language is not great&#x2F;usable by itself (that&#x27;s why there&#x27;s no money in writing programming languages), but by it&#x27;s rich ecosystems and community. D was created for novice programmers originally (as programmer&#x27;s language), but the idea is long dead. It is a mess at this point. You need to be a seasoned&#x2F;experienced programmer to even maintain a large code base. Using D itself is a code smell, IMHO.<p>Sorry for venting out, I was the one who recommended D at my past workplace and I was just frustrated my decision and it&#x27;s consequences.<p>[1] <a href="https:&#x2F;&#x2F;marketplace.visualstudio.com&#x2F;items?itemName=webfreak.code-d" rel="nofollow">https:&#x2F;&#x2F;marketplace.visualstudio.com&#x2F;items?itemName=webfreak...</a>