Live data from Hacker News

Driving with D

dlang.org

11–20 of 186 posts

Re: Driving with D

#11
post #2

Any reasons D never caught on more? No big tech company anchor behind it?

Not different enough to be worth switching from Java/C++ with their much bigger and more established communities. This was especially true earlier in it's history when it required GC. Now it doesn't, but it has to compete with Rust which can also offer memory safety.

Re: Driving with D

#12
post #7

Earlier quoted context omitted.

Challenging to overcome languages like C++, Rust, Java, and C#. D seems to sit somewhere in between, a better C++, but with (optional) GC. The thing is, Java and C# are already making strides into that space.

I am curious to see where Java are C# are making progress towards optional GC. This specific article talks about using No GC aka "betterC". D has GC by default; the use of GC is convenient and mainstream as most popular languages show - Java/C#/Python etc. What D gives is the unique ability to do No GC programming for the cases where GC is not desirable. Very few languages offer this capability. Zig is interesting in…

C# has added a lot of control over memory layout. Span [0], structs etc. I am hoping they add more D like features (@nogc) to the language. Java itself has just made strides on reducing GC pause times [1].

Granted, this isn't optional GC, but does D really give you that? Don't you lose the entire ecosystem and stdlib with -asBetterC? Why would I choose that over rust/zig/c++?

FWIW, I am a big fan of D.

[0] https://docs.microsoft.com/en-us/archive/msdn-magazine/2018/...

[1] https://malloc.se/blog/zgc-jdk16

Re: Driving with D

#13
Hi, I'm the author of the article. Feel free to ask any questions you may have.

I have to go to bed, I have work in about 4 hours, so I'll reply when I can.

Re: Driving with D

#14
post #2

Any reasons D never caught on more? No big tech company anchor behind it?

Challenging to overcome languages like C++, Rust, Java, and C#. D seems to sit somewhere in between, a better C++, but with (optional) GC. The thing is, Java and C# are already making strides into that space.

D was released 9 years before Rust, making it unlikely that rust had much influence on D adoption.

Re: Driving with D

#16
post #13

Hi, I'm the author of the article. Feel free to ask any questions you may have. I have to go to bed, I have work in about 4 hours, so I'll reply when I can.

This is what I love HN for. Every now and then there's a submission like this that makes me go: "How do you even...".

That being said, is there maybe somewhere a more thorough write-up about the whole thing? You know, with more in-depth technical details, gotchas, and so on? I'm sure many people would enjoy reading that!

Thanks for posting!

Re: Driving with D

#17
post #2

Any reasons D never caught on more? No big tech company anchor behind it?

I used D for a while. It improves several things over C++, among them:

- More powerful metaprogramming capabilities.

- Better module and library system.

- Nicer syntax.

The problem IMO is it's just not enough to justify a total move from C++ -> D. The syntax of C++ can't really be fixed, but the other aspects can be improved without a new language.

Furthermore, many of the other downsides of C++ are still present:

- The complexity of the language, and then the sheer number of different ways of doing the same thing.

- Some pretty dark corners in the way stdlib/language feature were implemented that seemed hard to ever fix.

- The way behaviour is specified in the language is very tied to the underlying hardware: rather than explicitly describing behaviour in terms of an abstract machine, it works more in the way C++ is specified where we all know it operates on an abstract machine thanks to compiler optimizations, but the spec likes to pretend it doesn't...

And then there are problems that are introduced by D, such as the fact that a safe subset exists, but depends on GC, so there's a weird split where no "safe code" can be used in contexts where GC is unsuitable.

Contrast this to Rust, where:

- There is a true step-change in bringing safe code to all contexts, not just those where GC can be used.

- It's missing a lot of the complexity of C++. Rust is hard because it has concepts that are foreign to a lot of programmers, but the total number of features is low (compared to C++) so there are fewer surprising ways they can interact.

- Rust is a suitable replacement for C, not just C++, because it's not just adding more features.

Re: Driving with D

#18
post #15

UFCS example uses units, which looks neat, but assigns injectorWidth to a variable injectorTime, which seems wrong?

I use D every day at work (inherited codebase) and the UFCS bothers me to no end. I try not to use it.

Re: Driving with D

#19
post #17
post #2

Any reasons D never caught on more? No big tech company anchor behind it?

I used D for a while. It improves several things over C++, among them: - More powerful metaprogramming capabilities. - Better module and library system. - Nicer syntax. The problem IMO is it's just not enough to justify a total move from C++ -> D. The syntax of C++ can't really be fixed, but the other aspects can be improved without a new language. Furthermore, many of the other downsides of C++ are still present: -…

The idea that Rust is suitable to replace C and D isn't is odd to me. It's really not hard to do + we (unlike some languages, not sure about rust) actually test on embedded targets via GCC.

Re: Driving with D

#20
post #15

UFCS example uses units, which looks neat, but assigns injectorWidth to a variable injectorTime, which seems wrong?

The units are a mix of D's UFCS and metaprogramming. I find it helps keep track of which units are used where in the code base, and stops me from accidently running operations on wrong unit types and such.

Injector width / time pretty much means the same thing (at least in my code base). My apologies for the confusion.

Post reply on HN