1. 33

Finally wrote my retrospective of Advent of Code in D.

Many thanks to those who discussed the problems with me in #lobsters. :-)

  1. 11

    I’m not sure why D isn’t more popular. My guess is some teething issues back in the day limited its growth:

    • std lib split with phobos/tango
    • D1 vs D2 changes
    • dmd compiler backend license
    • lack of a build package manager (eg. pre dub)

    From what I understand, these have all since been resolved. It will be interesting to see if D usage picks up, or if those early speed-bumps made too much room for other (newer) languages to pass it by (Go, Rust, Swift).

    1. 7

      For me, D is known and perceived just as a “better C++” (Alexandrescu is one the brightest evangelists of D and his C++ past does not help with the language image) and I do not want a better C++. I do not want another deeply imperative programming language that can do some functional programming accidentally. I do not want another language born from the culture of obsessive focus on performance at the expense of everything else.

      What I want is a ML-ish language for any level of systems programming (sorry, D and Go: having GC is a non-starter) with safety and correctness without excessive rituals and bondage (like in Ada). Rust fits the bill: it’s explicitly not functional, but has strong safety/correctness culture.

      1. 7

        Precisely because of the lack of GC and the focus on lifetimes, Rust is much more similar to (modern) C++ than D will ever be. Writing Rust is like writing correctly written C++.

        D, having a GC, leads to different programs (than C++ or Rust) because of this global owner for resources that are only memory. eg: slices have no ownership information in the type system. This makes scripting very friction-less, at the cost of some more problems with non-memory resources. But not at the cost of speed.

        D has @safe which is machine-checked, opt-in memory safety.

        1. 4

          Thanks for the clarification, indeed I had a slightly wrong impression about the D programming style and ignored the profound influence of garbage collection on the programming style.

          Still, everything that I learn about D irks me (native code with GC by default? metaprogramming with native code, without dynamic eval? opt-in @safe?!) and feels too much like the old C++ culture with its insensible defaults.

          1. 2

            native code with GC by default?

            This is why Go appealed to so many people isn’t it. This is the “new normal”. (Of course, OCaml etc had this before)

            dynamic eval

            This is probably a bridge too far if you are appealing to people from C++ background (C++ programmers as target audience is bad market strategy for D, IMHO)

            Opt-in @safe.

            I agree with you on this.

            feels too much like the old C++ culture

            Well, the two main D architects are old C++ hands after all!

      2. 6

        I think I addressed at the very top the current biggest obstacles to D adoption. I encounter them often when I try to excitedly discuss D with anyone.

        1. 6
          • Go – Too limited a language. It has good marketing behind it. Outside of having some libraries that are not available natively on D (or C), there is no good reason to use Go as a D programmer.
          • Rust – A very strong competitor. Not every program needs Rust’s level of thinking about memory (though some of Rust-exclusive feature do make it attractive over D)
          • Swift – Nice enough language. Is still an alien on Linux (Windows, what is even that?). D has first class support on both Linux and Windows.
          1. 3

            I agree with all those points.

            I was more thinking about folks skipping over D in the past, and how that potentially limited its uptake, than from the perspective of a D programmer looking at the current popular trends. Certainly an interesting perspective though. Thanks for sharing!

          2. 2

            Indeed all those points have since been resolved. What hasn’t been resolved is that there isn’t a simple message to give as a marketing motto, since D tends to check all the boxes in many areas.

            1. 4

              I think it should go back to its roots, which is why I happen to like it: “D: the C++ you always wanted.”

              1. 2

                But nowadays there are much more people that were never exposed to C++ in the first place.

                1. 1

                  Very true!

                  Also, I must be one of the few people who learned C++ and never learned C. “C/C++” has always irked me, as if the two were easily exchangeable, or worse, the same language.

          3. 9

            A d tag would be very nice to have!

            1. 3

              you know the drill, gather sample links that would benefit from having the tag then make a meta post.

              1. 7

                Duly submitted.

                1. 2

                  Thank you (and the admins) for doing this. D now has a tag: https://lobste.rs/t/d

            2. 9

              If you are interested about D, I wrote d-idioms as a way to quickstart your understanding, starting with the edge cases :) => https://p0nce.github.io/d-idioms/

              I have built my company with this language and it’s picking up steam in my local area. Usually people dismiss D immediately when they first heard of it ; I find it nothing short of fascinating, and well usable since the last ten years.

              1. 1

                I’d be very interested in chatting about strategies. My company is pivoting towards Rust and while that might feel like competition, breaking the monoculture of C is to everyones gain in that area. (Same goes for, for example, Ada in the embedded space)

                (I’m based in Berlin)

                1. 1

                  strategies? What do you mean?

                2. 1

                  Are you in Germany? For some reason, it seems that Germany is the only place where D has really picked up.

                  1. 1

                    Not very far from Germany :)

                3. 4

                  A longish but very nice read for the D-curious, though it is from the point of view of small self contained projects.

                  1. 4

                    It still got me questioing why I’ve never written anything in D!