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

I'm not convinced about that. Writing a formal contract for a function is incredibly hard, much harder than writing the function itself. I could open any random function in my codebase and with high probability get a piece of code that is < 50 lines, yet would need pages of formal contract to be "as correct" as it is now.

By "as correct", I mean that such a function may have bugs, but the same is true for an AI-generated function derived from a formal contract, if the contract has a loophole. And in that case, a simple microscopic loophole may lead to very very weird bugs. If you want a taste of that, have a look at how some C++ compilers remove half the code because of an "undefined behaviour" loophole.

Proofreading what Copilot wrote seems like the saner option.




That is because you have not used contracts when you started developing your code. Likewise, it would be hard to enforce structured programming on assembly code that was written without this concept in mind.

Contracts can be quite easy to use, see e.g. Dafny by MS Research.




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

Search: