11 ms·
It's a mystery why D isn't far more popular than it is. Fast compilation, familiar syntax, and supports a wider range of programming paradigms than most (any?)
by eric-p7 1y ago
It's a mystery why D isn't far more popular than it is. Fast compilation, familiar syntax, and supports a wider range of programming paradigms than most (any?) other language.
- nickpp 1y agoLack of large “sponsors”.
- zem 1y agoscala is probably the poster child for supporting every paradigm you might want to use :) oz/mozart has more but that was essentially a research/teaching language specifically designed to use a wide range of paradigms in order to demonstrate them.
- Imustaskforhelp 1y agoCan you please specify more to be honest. This comment really catched my eye and maybe has pushed me to trying out scala but like my issue is that everywhere it says that scala primarily works good for OOP but like I know it can do functional too. I am not sure if what supporting every paradigm is a definitely good thing though I feel like I would love the freedom to do so. I am a tinkerer at heart/first and a coder at second and my favourite language is probably go and then nim/julia/elixir/typescript/<it depends on the project>
- zem 1y agoscala is intended to provide full support for both functional and object oriented programming. the positive side is that it will support programming in whatever style you like, or any mix in of styles. the negative side is that it is a huge language with a complex type system, and that the library ecosystem has a mix of various styles, e.g. there is scalaz which is heavily inspired by more purely functional languages like haskell, and scalaz code will look totally bizarre to you if you have mainly been using the object oriented features of scala. (contrast with go, which is on the opposite end of the spectrum in that a design goal is that go code should look familiar no matter where you see it, because the language supports a very constrained style of programming)
- nicoburns 1y agoI'd say that the compiler not being open source during the period when it might otherwise have become popular is probably a pretty big factor.
- destructionator 1y agoThe D parts of the compiler were released under the GPL from almost the beginning, since 2002. By 2004, a full open source compiler - what we now call gdc, officially part of gcc - was released using this GPL code. D was pretty popular in these years.
- Keyframe 1y agoI spent quite a few year on/with it back in the day. There was D1 which was like a better C, and then there was D2 which was like a better C++. Personally I preferred where D1 was going (and Tango instead of Phobos) but even with D2 it really made the day compared to what was out there and to this day still to an extent is. The thing that killed it for me, and I know at least a couple of friends as well (outside of internal politics at a time) was what kills pretty much all exotics once you start using it. Lack of (up-to-date) libraries / bindings and tooling. At the end of the day that's what you do use for most of the work you're doing anyways - libraries. So suddenly you're doing all these bindings and battling tools instead of working on actual problem at hand. This gets tiresome real quick. For some reason, and mostly that being Mozilla, Rust got quite an initial kick to overcome that initial hurdle in haste. We're not going to mention a lot of those libs are stale in Rust world, but at least they're there and that kind of gives you momentum to go forward. Whatever you're trying to do, there's a non-zero chance there's a library or something out there for you in Rust.. and we got there real quick which then encouraged people to proceed. That's just like my opinion, man.. but I think a key part is that first lib bindings hurdle which Rust somehow went over real quick for a critical mass of it; D hasn't. Love the D though lol, and Walter is a 10000x programmer if you ever saw one but it might be time to hang the hat. I can only imagine how a community like Rust or I don't know Zig of those up-and-coming would benefit from his help and insights. He'd probably single-handedly make rust compile 100x faster. One can hope.
- steveklabnik 1y agoI spent time back in the day with D as well, incidentally. I wonder if we crossed paths back then.
- Keyframe 1y agofor sure we did, Steve! Sometimes multiple times a day even, hah. Check out @keyframe2 on bsky or @keyframe on the evil platform and let's reconnect.
- steveklabnik 1y ago
- WalterBright 1y agoWe don't have a marketing budget, although we have many hard core users!
- johnisgood 1y agoIs that really it? Why cannot you get a marketing budget, sponsored perhaps? BTW: I am not fond of stuff like: // Sort lines import std.stdio; import std.array; import std.algorithm; void main() { stdin .byLine(KeepTerminator.yes) .uniq .map!(a => a.idup) .array .sort .copy(stdout.lockingTextWriter()); Are there any ways to do this that do not involve a bunch of "."s? I do not understand "map!" and "a.idup" either, FWIW. I really want to like D, but it tries to do too many things all at once, in my opinion. Perhaps I will give C3 a fair try.
- WalterBright 1y agoThat code is an example of f(a) being equivalent to a.f(). You can do it the f(a) way if you prefer. `map` is an operation on a data structure that replaces one element with another, in this case `a` gets replaces with `idup(a)`. The `idup` makes a copy of its argument in memory, and marks the data is immutable.
- johnisgood 1y ago> That code is an example of f(a) being equivalent to a.f(). You can do it the f(a) way if you prefer. How would it look like with this particular code? Just for comparison. > The `idup` makes a copy of its argument in memory, and marks the data is immutable. How is one supposed to know this? Reading the documentation? I really want to look at the code and be able to know straight away what it does, or have a rough idea.
- zdragnar 1y agoSee https://en.m.wikipedia.org/wiki/Uniform_function_call_syntax https://en.m.wikipedia.org/wiki/Uniform_function_call_syntax - the examples section has two side by side. The Nim language version is also pretty readable even if you're not familiar with it. As for idup... The first several search results for "dlang idup" are all useful. > I really want to look at the code and be able to know straight away what it does, or have a rough idea. I presume you really don't like perl, ML based (ocaml, f sharp, rust) Haskell or K.
- dataflow 1y ago> It's a mystery why D isn't far more popular than it is. There's no mystery. It's a jack of all trades, master of none. E.g., the virality of the GC makes it a non-starter for its primary audience (C/C++ developers). The need to compile and the extra verbosity makes it a bad substitute for scripting like Python. Etc. Basically, name any large niche you'd expect it to fill and you'll probably find there's a tool already better suited for that niche.
- bachmeier 1y ago> the virality of the GC makes it a non-starter for its primary audience (C/C++ developers) No. If you were to say you need the GC to use all features of the language and standard library, of course, the GC does important things, but to claim a C developer wouldn't be comfortable with it because of the GC is nonsense. Just don't allocate with the GC and use the same mechanisms you'd use with C (and then build on top of them with things like @safe, reference counting, and unique pointers).
- dataflow 1y ago>> the virality of the GC > Just don't allocate with the GC "virality" is not just a word you can ignore.
- bachmeier 1y agoI don't understand. If you're a C programmer and want to avoid the GC, there's nothing to be viral.
- dataflow 1y ago> If you're a C programmer and want to avoid the GC, there's nothing to be viral. What you're suggesting is the moral equivalent of "it's easy to avoid diseases, just avoid contact with those infected", or "it's easy to avoid allergens, just avoid foods you're allergic to", or "it's easy to avoid contamination, just set up a cleanroom", or "it's easy to write deterministic code, just avoid randomness", etc. Yes, there are things that are easy to achieve in the vacuum of outer space, but that's not where most people are interested in living.
- GZGavinZhao 1y agoMostly wrong place at the wrong time, I guess :( Plus the chicken and the egg problem. This is mostly from the AerynOS experience : it seems like if you want to write some moderately complicated code then you're becoming the upstream of many libraries. Especially now with Rust's popularity and ecosystem maturity on the rise, it's super hard to convince people (e.g. your boss) that you'd be better of with D compared to e.g. Rust.
- WalterBright 1y agoWhere D shines is how readable D code is compared to other languages.
- troupo 1y agoIIRC it was weird and not that great in D1 era, and stalled for a very long time. There were also two competing incompatible runtimes. Then came the D2 re-write which broke backwards compatibility and took another few years. In the meantime everyone moved on
- destructionator 1y ago> D2 re-write No such thing happened. D has always been built on the same codebase, and the labels "D1" and "D2" are just arbitrary points on a mostly linear evolution (in fact, the tags D 1.0 and D 2.0 came only 6 months apart; 1.0 was just meant to be a long term support branch, not a different language. It was the addition of `const` that broke most code around release 2.6 but if you update those, old and new compilers generally work. I'd say where D failed was its insistence on chasing every half-baked trend that someone comments on Hacker News. Seriously, look at this very thread, Walter is replying to thing after thing saying "D has this too!!" nevermind if it actually is valuable irl or not.
- WalterBright 1y agoI've actually tried to remove some features from D, but there's always someone who built a store on it.
- mrkeen 1y agoArticles like this I guess. If these are the 'lovable' features I'd hate to see the 'meh' features. Automatic constructors - You only have to write the 'make me a box of two apples' code and not 'this is how two apples go into a box'! This is as revolutionary as 'automatic function calls', where you don't have to manually push the instruction pointer to pop it back off later. Parenthesis omission! If I were to parody this I'd talk about how good Scala is - in addition to classes, you can also declare objects, saving you the effort of typing out the static keyword on each member. Sell me something nice! Millions of threads on a node. Structured concurrency. Hygienic macros. Homoiconicity. Higher-kinded types. Decent type inference. Pure functions. Transactions.
- WalterBright 1y agoD has pure functions: https://dlang.org/spec/function.html#pure-functions https://dlang.org/spec/function.html#pure-functions D's pure functions are quite strict. It can be a challenge to write a function that passes strict purity guarantees - but the result is worth it!
- zem 1y agocompile time function evaluation is "nice" in the same way those features are, isn't it?
- WalterBright 1y agoWhat's interesting is that other languages have since adopted CTFE, but they missed the point and did it wrong. The usual mistake is to add a keyword necessary to trigger it. D triggers it when an expression appears where a "const-expression" appears in the grammar. I.e: int x = f(); // f() is run at run time enum y = f(); // f() is run at compile time
- giancarlostoro 1y agoI needs a "Django", "Rails", "ASP .NET" type of project that is out of the box ready. Go has net/http out of the box. I think if D had either a batteries included (Vibe.d is nice, but you have to handle some things still) web framework, it might convince some folk to use it more. Go spread the way it did because it was dead simple to make websites and services, the syntax is insanely simple, but the language allows you to scale without going through a ton of hoops. Look at how much of our IT infrastructure is powered by Go now. D has a lot of potential, but someone has to sit down and build frameworks and tooling for D. I think if D had officially supported libraries by core maintainers that take full advantage of the best of D it might be a different landscape. Another area where D could shine is GUIs. Everything is electron these days, it feels like nobody builds usable GUI stacks. If D had an official solution to this, and it worked nicely and gave you enough power to customize your UI, we might see a shift there too. I welcome a Electron free future. Look at the Zed editor (ignore the AI buzz) and how insanely fast it is. Its coded in Rust, and uses WGPU iirc to just render everything kind of like a video game, but it runs insanely fast. It is my new favorite text editor. Sadly despite my deep love of D, Go is where I'm leaning more towards, due to industry pull there.
- zem 1y ago> Another area where D could shine is GUIs I've often thought that, to the extent that I spent a while looking for some active projects I could contribute to, and came up blank. if I do have some new gui based program of my own I want to write I will at least consider d for it, though ocaml is another great language in the same space and I already have some experience with ocaml/gtk. my hope was that d would have more mature gui toolkit bindings and more of a community of people writing apps, which would have been some incentive to switch over from ocaml, I was disappointed to find that wasn't the case.
- giancarlostoro 1y agoI think it needs to do build its own GUI stack and not rely on any others, maybe take inspiration from tooling like Delphi's which allowed you to add themes on a whim.
- LugosFergus 1y agoLack of sufficient tooling support was my issue. Debugging and autocomplete was a flaky mess in VSC. The plugin for VS pro wasn’t much better. I did not like DUB at all. Its default behavior was to not segregate artifacts by configuration, and trying to change that was a headache. It’s too bad, though. It’s a nice language, but I can’t see it making any inroads at this point.