Remix.run Logo
noveltyaccount 4 hours ago

This prompt defines the translation as a file for file, line for line port. Seems like historical knowledge will be fine.

mr_00ff00 4 hours ago | parent | next [-]

Having dabbled with both Zig and Rust, they do things so fundamentally differently, it isn’t possible to do exact lines like that.

mswphd 3 hours ago | parent | next [-]

the rust they've written (so far) is highly unidiomatic (and with a ton of unsafe). I can't speak to the zig part, but it seems plausible to me it is line-by-line, horrendous rust.

Whether or not they can clean it up is an interesting question.

dathinab 32 minutes ago | parent | next [-]

zig can do some things wrt. compiler time compute which sits somewhere in between rust const expr and proc macro usage. This isn't something rust (or most languages) have. So even if we are generous and interpret line by line as expression by expression this isn't fully doable

but also telling a LLM to do a line-by-line translation and giving it a file _is guaranteed to never truly be a line-by-line translation_ due to how LLMs work. But thats fine you don't tell it to do line-by-line to actually make it work line by line but to try to "convince" it to not do any of the things which are the opposite (like moving things largely around, completely rewriting components based on it "guessing" what it is supposed to do etc.). Or in other words it makes the result more likely to be behavior (incl. logic bug) compatible even through it doesn't do line-by-line. And that then allow you to fuzz the behavior for discrepancies in the initial step before doing any larger refactoring which may include bug fixes.

Through tbh. I would prefer if any zip -> terrible rust part where done with a deterministic, reproducible, debug-able program instead of a LLM. The LLM then can be used to support incremental refactoring. But the initial "bad" transpilation is so much code that using an LLM there seems like an horror story, wrt. subtle hallucinations and similarr.

vintermann 2 hours ago | parent | prev [-]

If anyone can do it, it's Anthropic. The question is more how long it will take and how many tokens it will burn/how much groundwater.

swyx 2 hours ago | parent | prev [-]

care to attempt a top 3 differences that someone doing this kind of rewrite should know?

(would teach me a little about Zig, about which i know 0)

jjice 4 hours ago | parent | prev [-]

It makes the git history a bit more confusing to follow if you want to see old changes, but I'm sure a simple wrapper to check for the zig equivalent files as well wouldn't be very difficult.