14 ms·
(Shrug) If I want Rust, I'll feed my C++ to an LLM and tell it to port it to Rust. Since we've been assured that Rust magically fixes everything that's wrong,
by CamperBob2 10mo ago
(Shrug) If I want Rust, I'll feed my C++ to an LLM and tell it to port it to Rust. Since we've been assured that Rust magically fixes everything that's wrong, bad, or unsafe about C++, this seems like a sound approach.
- galangalalgol 10mo agoWe probably aren't that far off actually. Even taking asm with no symbols back into rust works well. You have truth, just have the agent repeat until the asm matches. Doesn't work on giant codebases, but on a few functions it absolutely does. And while the llm may get the algorithm wrong, the type system does seem to help it generate useful code in rust for a starting place v
- pjmlp 10mo agoYeah, but then just let the agent generate proper C++ code, contrary to an human it doesn't forget about best practices, or how ownership is supposed to be handled.
- galangalalgol 10mo agoExcept the llm forgets about that in rust too, then the agent looks at the ownership errors from the previous iteration and fixes them.
- pjmlp 10mo agoFirst it needs to have a Rust ecosystem available, e.g. CUDA, SYSCL, HFT, HPC,... Maybe it could be used to remove Rust dependency on C++ infrastructure (LLVM/GCC), and bring Cranelift up to speed.
- pjmlp 10mo agoYou missed the other take, with AI assisted coding, you can stay in C++, as it will take care everything is coded with enough care. Or why bother with Rust, when the LLM gets to generate C++ code with best practices. While I like Rust, I think AI as the next abstraction step in programming has kind of taken its relevance away, when computer assisted programming is part of the workflow.
- testdelacc1 10mo agoStrange. I wouldn’t trust the output of a coding agent and I would want stronger review of its output. If it passes a strict compiler that gives me more confidence than if it passed a lax one. But sure, if you trust it to have written C++ to a higher standard than the experts, then go for it.
- pjmlp 10mo agoSo not into the vibe coding hype taking over all our jobs?
- testdelacc1 10mo agoIt is what it is, I accept that’s where the industry is heading. But if I have to produce reams of code I’d much rather have it be reviewed by rustc than clang. rustc may take longer to satisfy, but it’ll be worth it because I won’t be responsible for horrors in production. You’re happy to be responsible for buffer overflows written by an LLM? I’m not, which is why I prefer a language where it’s not possible.
- pjmlp 10mo agoIt is definitely possible, only not as easy.
- testdelacc1 10mo agoEven reviewing human written C++ is difficult. Android has had 20 years to figure it out and they couldn’t find a way to reduce the number of vulnerabilities they introduced in carefully crafted C++ code. I shudder to think how many more they would have introduced if they had vibe coded it.
- CamperBob2 10mo agoYeah, good point, I don't know how I missed that possibility. /s of course... for now, but not for long.