Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I did C++ for over 10 years, and now have been doing rust for about 4. On the whole, I like rust much better, but I really miss header files.

Modules are horrible for build times. If you change an implementation (i.e something that would not normally involve editing a header) the amount of rebuilding that happens is crazy, compared to any C++ project that was set up with a minimal amount of care.



What was it about headers?

In terms of rebuild performance in defining the interface vs implementation, there is interest in having rustc handle that automatically, see https://rust-lang.github.io/rust-project-goals/2025h2/relink...


That change sounds like a big improvement if they manage to do it!


Changing the private module fragment (equivalent of a source file) shouldn't cause rebuilds since it doesn't change the interface.


D modules are very fast. Many of our customers rely on D being way faster than C++ to compile.


I often hear about a lot of advantages of D. So I don't understand why it is so unpopular. Probably I need to give it a chance, but I'm unsure that I will find a real job with the D stack.


Most languages that have made it big have been the primary language for a platform that made it big, and it is really the features of the platform more than those of the language that have driven that.


> Most languages that have made it big have been the primary language for a platform that made it big,

I think you're going to want to define "made it big" and then make yourself some lists as this to me sounds like it doesn't have much explanatory power.


D is fine. Like many languages that postdate C++ and Java, it made better choices, learning from the past. But it doesn't really have a differentiator.


Knowing D will make you a better programmer in other languages. For example, D pushes you to write better encapsulated modules, which is a transferable skill.


How does D avoid the problem I described?


For one thing, it never has to compile a module more than once, no matter how many times it is imported. For another, the compilation of a module is done on demand. For a third, D modules can be "header only", omitting the implementation.


[flagged]


They tell me, I don't need to think it.


What kind of argument is that? It's like an ad hominem, but in some weirdly complementing way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: