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

Headers are a pricier mistake than the billion-dollar-mistake.

IMO they are the #1 reason C still has a lot of adoption, but not for good reasons: headers hinder interoperability. To interop with C you either need a C-compatible compiler (C++, Obj-C, and now D, Zig) or a human writing interop code by hand. Both things come with a hefty cost, and the first carries the danger of your language having to keep terrible features forever (the C part of C++).

Headers hinder the evolution of the language and the ecosystem.

Modules, on the other hand, enable interop easily, preventing lock-in.



> To interop with C you either need a C-compatible compiler (C++, Obj-C, and now D, Zig) or a human writing interop code by hand.

It's the other way around - C is so easy to interop to that you don't even need to do anything. Modules, on the other hand, or such an effective lock-in that you can't reasonably automate the interop with it.

With a C header, all I need to do is run a single command that generates interfaces based on it for almost every language there is. Try that with any module-based system.




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

Search: