by andr3w321 · 9y ago · 0 comments
1. Write code
2. Run code
3. See error
4. Google error
5. Write code to fix error
6. Repeat
I'd like a compiler that helps speed up steps 3-5. I know IDEs do some of this, but I'd like a compiler that automatically fixes errors instead of just telling me what went wrong. One that fixes parentheses that I left off or automatically fixes typos in variable names or function calls. One that knows to keep things DRY and creates a function for me when it sees the same similar code written twice. One that knows when I wrote an inefficient bubble sort and swaps it out with a faster sorting algorithm etc. One that can make my code run faster. I think this is a long way off, and I know it's really hard to write a program that writes code, but it's always seemed that programming simple things is way harder and takes longer than it should to me.
> One that knows to keep things DRY and creates a function for me when it sees the same similar code written twice
This is potentially an interesting idea.
> One that knows when I wrote an inefficient bubble sort and swaps it out with a faster sorting algorithm etc.
This is also the sort of thing that optimises out your security-critical delay loop or memory wipe.
Some of the other stuff you mention is not a way long off if you use an IDE like Visual Studio, which, with or without Resharper does a lot of code analysis. You get notified if you have dead code (branches that never get ran), duplicate code (i.e., things that should be turned into a common method or class), etc.
Webstorm can do some of what you mention:
https://news.ycombinator.com/item?id=15514285
https://news.ycombinator.com/item?id=15638652
One that knows to keep things DRY and creates a function for me when it sees the same similar code written twice.
Unfortunately this is "sufficiently smart compiler" territory. I'd love to be wrong about that though.
What you request in the last paragraph is a Junior Developer to do the grunt work of implementing a spec.