5 ms·
OpenAI Codex Python to C++ Code Generator
- accountofme 4y agoInteresting idea.... I wonder if the same could be done for c/c++ -> rust :D
- lionkor 4y agoC++ is already very safe if written in a modern style. Ive not had a real modern C++ program crash or UB on me in a while. It would be interesting to translate old C++ to modern C++, which should be pretty easy
- accountofme 4y agoI am happy for you. I once liked c++ but after years of writing it professionally. I am done. You have to fight c++ to get things working which obfuscates problems in the code. Safety comes from simplicity -- c++ is never simple. I could rant about this for hours. But in my opinion rust is a better language and the one we as software engineers should get behind for safe systems. C++ is old and needs to be retired.
- mountainriver 4y agoLack of function overloading in Rust makes this fun!
- accountofme 4y agoHaha you are right there! That does make it a whole bundle of fun :)
- axg11 4y agoA question for the computer scientists here: are there applications for this where Codex could be used to automatically optimize complex systems?
- heyitsguay 4y agoPossibly, but if Codex is like similar AI text generation tools, complex systems or large software architectures with many interacting components are going to specifically be the corner cases where results are less reliable.
- qsort 4y agoThe real problem is how do you ensure that code alterations preserve observable behavior. Complex systems generally have complex specifications.
- idan 4y agoShameless plug for Copilot Labs, which offers arbitrary language-pair translations. https://githubnext.com/projects/copilot-labs/ https://githubnext.com/projects/copilot-labs/ Warning, Codex is nondeterministic and sometimes nonsensical! Good prompts are hard to find.
- chubot 4y agoI'm writing a Python to C++ translator for https://www.oilshell.org https://www.oilshell.org. The shell itself is less than 40K lines of code and the translator is ~4-8K lines. And I even have a 50K euro NLNet grant to hire someone! Brief Descriptions of a Python to C++ Translator https://www.oilshell.org/blog/2022/05/mycpp.html https://www.oilshell.org/blog/2022/05/mycpp.html --- But I don't think there is anything interesting in this repo. It doesn't show anything that works, and doesn't really make any claims. But maybe it would be a fun illustration of the limitations of AI. So I would propose that if you can get even 1000 lines of Oil's code translating and running correctly with AI, I will award you a big part of my grant. I think it's impossible with the state of the art. I don't have much interest in current ML techniques, but I'm credited on a deep learning paper with thousands of citations, so it's not a totally uneducated claim. --- On the other hand, I'm looking for a C++ / Python / compiler engineer, particularly in the European Union. Please take a look at Oil Is Being Implemented "Middle Out" [1] and send leads my way :) (e-mail in profile) [1] https://www.oilshell.org/blog/2022/03/middle-out.html https://www.oilshell.org/blog/2022/03/middle-out.html
- jasfi 4y agoI think it would be simpler to convert Python to Nim, which itself compiles to C. That's assuming this is for performance gains only.
- Traster 4y agoSo my understanding is it works like this: You take some Python you throw it at OpenAI and you see if the resulting C++ compiles. Doesn't the fact that you need to check the result even compiles also imply you probably want to check if the result is functionally correct also?
- darepublic 4y agoYes certainly you may need to check that even if the code compiled