Hacker News new | past | comments | ask | show | jobs | submit login

Don't forget C, which has separate compilation as well ;-). And you can trivially make multiple interfaces, too.



Separate compilation without type safety, hardly much better than macro assemblers.

So yeah, you can go that route and I have done so, poor man's modules, as it helped to keep me sane with C, but it requires discipline.


> but it requires discipline.

That pretty much defines software engineering.

For as long as I have been coding, I’ve watched people and corporations chase the will’o the wisp of the “undisciplined coder,” where we can hire naive, barely-educated children, straight out of school, and mold them into our personal “coding automatons,” or even better, let people who are experts in other domains, create software, without having to deal with “annoying” engineers.

So...how’s that working out?

Even when we have AI creating software (and we will), the AI will still need disciplined requirements, which, I suspect, will look a lot like...code.


Pretty good, every solution that expects discipline is a source of revenue for security consulting, code quality automation products and conferences.

The outcome of Azure Sphere having chosen C as their main SDK language is proving itself without surprises,

https://techcommunity.microsoft.com/t5/internet-of-things/az...


> That pretty much defines software engineering. Sure, but by moving things that require discipline into type systems/tools, it makes working with others easier.

Not to mention that no matter how disciplined you are, you will make mistakes, and having the compiler catch those for you is valuable.

It also means that the discipline applied by the programmer can be focused on areas that can't be checked or enforced by a compiler.


> So...how’s that working out?

Fantastically if the goal is to set up recurring revenue to maintain the produced systems.

> Even when we have AI creating software (and we will), the AI will still need disciplined requirements, which, I suspect, will look a lot like...code.

https://github.com/webyrd/quines is an interesting example of writing code to create code based on a specification. Perhaps not the AI code generator of some people's dreams, but it exists today.


There’s just a certain amount of effort that you can spend in a certain amount of time. And discipline takes effort. If you need less discipline you can spend your effort somewhere else. For instance you can put effort into fitting your code into an ownership model like in Rust or proof the code with Coq. The difference is that with C you can never know if there was enough discipline (usually there isn’t).


It’s my experience that discipline is “front-loaded.” It takes conscious effort for some time, while establishing a habit, then, it becomes pretty much “free.”

For example, when I was writing ObjC and PHP, I got used to using Whitesmiths indenting. Once I started writing Swift, it was more appropriate to use KNF style.

It took a couple of months of having to remember to not use the old indenting style, but I haven’t given indenting any thought in years.

”We are what we repeatedly do. Excellence, then, is not act; but a habit.” -Attributed to Aristotle


> So...how’s that working out?

So well that it was a large part of the reason I accepted an offer (today in fact) somewhere else, life is too short for that mess.


How are modules related to type safety?


Because, if you program in a type-safe language, if you call something that is compiled separately from you, you'd still like to maintain type safety across that call boundary.


You absolutely get type safety across module boundaries with C in that if provider and user both compile against the same interface, this will be typesafe.

You could even have this type safety on the linker level as far as C is concerned. You just need an object file format that exports C types for symbols. This is not done on any of the (few) systems I know, and probably for practical reasons.

Some other languages give you this link time safety, but I assume at the cost of less interoperable object files.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: