Hacker News new | ask | show | jobs
by rapjr9 433 days ago
Code reuse used to be thought of as the ultimate destiny for computer code. Eventually you would never have to write new code, it would all exist in some form and you would just reuse it. We may actually be getting something like that through the use of AI for coding now. The problems with code reuse are many though. A function written in C for a microcontroller often won't work in a python program, especially not without all the include files, libraries, and a wrapper. How do you find the function that matches your needs? Coding language and function parameters offer some clues but are not sufficient. For example one function may do rounding on return values while another does not. Do you need a function optimized for speed, for object size, for time latency? Will the function work in your computing space? For example one function might use a loop, another might use recursion so running on an MCU one might work and the other might crash your stack. This might be a set of problems a LLM could sort out, but it would need some most excellant training data, not random stuff off the web. Even existing, working, industrial code bases would not be sufficient since there are huge sections of code in them that are legacy and mostly no longer used or relevant. It would probably have to be a constantly curated training database. And there is an inherent ambiguity in code, who is to say one implentation is better than another if they both work? This could make debugging challenging if the coding style is different in all the code snippets.