Back to News
Advertisement
Advertisement

⚡ Community Insights

Discussion Sentiment

70% Positive

Analyzed from 1202 words in the discussion.

Trending Topics

#more#rust#code#fable#bug#best#read#model#llm#port

Discussion (41 Comments)Read Original on HackerNews

drzaiusx11about 8 hours ago
I recently performed this exact exercise of converting a complex library set from one language into an intermediate state machine representation and then translated into N other languages. It worked well but there's a lot of caveats. I'd highly recommend a direct "port" in most cases tbh, as many bugs are "load bearing" and may not survive the intermediate translation. I speak from experience.
aka-riderabout 8 hours ago
> I'd highly recommend a direct "port"

I'm sure there are other caveats. Also cost of the more or less straightforward Bun port was $165000 for 500KLoC.

drzaiusx11about 6 hours ago
Are you implying a direct bug for bug port is more expensive than converting to an intermediate representation and then converting via generators? Depending on the "fidelity" of the representation I'd figure the costs are about the same.
dilyevskyabout 1 hour ago
Wouldn’t finding such bugs be considered advantageous? That is unless someone just yoloing the result directly to customer ofc
aka-riderabout 12 hours ago
Following the recent "Rewriting bun in Rust" I thought to run an experiment which turned out to be success.
onion2kabout 10 hours ago
Porting something to a language you don't know doesn't seem very helpful to me. You've locked yourself out of doing useful work except with continued application of more AI. Without the ability to verify it, except with even more AI maybe, you're starting on a slippy slope to slop.

If the experiment was "spend 400 bucks to see if it'll work" then that's awesome, and fun, and a cool use of AI. It's impressive that AI can do that.

If it was to make something useful ... has it?

aka-riderabout 10 hours ago
You are correct, that this is not the best Rust learning material.

$400 are subsidized into the subscription, and this was mainly an experiment to prove the theory about data conversion step. I call it a success and I use rune editor daily.

To me, running multiple agents is not very different from managing multiple teams — I won't be able to keep up with the changes by reading the code.

I may make certain architectural decision, and I need to act based on some signals.

The simplest example is clusters of bugs are signaling that certain modules are dirty. Sometimes I read a plan and understand that the agent is trying to workaround some auwful engineering.

qazxcvbnmlpabout 8 hours ago
I work on a C++ codebase. I frequently prototype in c and then have the ai model slopify it back to c++. Nice b/c I am faster at reading c, but hard b/c you miss some of the features/nuances of c++.
aka-riderabout 8 hours ago
I would be afraid to do this with C++.

My friend once sent me a snippet, maybe 10 lines of C+++, asking "can you spot the UB?".

So I'm staring at these 10 lines, I KNOW there is an UB. I wasn't able to find it without a hint.

itemize123about 2 hours ago
interesting, c -> c++ transition should be smooth though
coder-pmabout 11 hours ago
How much did the verification cost on top? how did you gate it? was it a Go test suite you ran against the Rust or what? I always wonder how ppl are testing these rewrites, rewriting the tests can also lead to bug. I really wonder how reliable are rewrites like that, a 65k lines you didn't actually read. How did you confirm the semantic equivalence, same behaviour?
aka-riderabout 11 hours ago
All very good questions.

Agents are actively destroy QA gates in many ways, usually by cheating ("the test is buggy, not my changes" — changes the test), or just rot QA slowly by writing buggy overcomplicated tests

What works for me 10/10 is fuzzing and my own constant usage. For this project specifically (text editor), I asked LLM to create human-like fuzzing session, it sends keystrokes like: "the user is searching for a file, editing, <ordering a lizard>, saves changes".

On top of it, I run https://mutants.rs/ which is kind of tests fuzzing. It flips random switches in the app itself, and if tests are silent - they missed a bug.

The downside of this, is I usually find bugs after 1-2 hours of running. I use local Qwen to babysit these sessions, to make initial investigation, a repro case, and file a ticket.

metaltyphoonabout 9 hours ago
Why are you just pasting LLM answers :(? I see this constantly in Slack DMs to every day from work. It hurts
aka-riderabout 10 hours ago
I realized that I haven't answered the question. These $400 also include the tests. Fable ported "human fuzzing session" (the best bug hunter) from Go to Rust and used it to validate everything else. I used hierarchical state machines, so a lot of my QA gates were encoded into the implementation — impossible states are, well, impossible.

(I ported first 80% practically in one shot, planning and then leaving Fable overnight to orchestrate). Then I added a bunch of features, so at the end I ported more like 150% of the original code, I added tree-sitter, and a bunch of syntaxes highlighters. At the end with all that, price went up to ~$650

coder-pmabout 4 hours ago
This is impressive but it again led me to questions. Porting the fuzzer from Go to Rust to validate Rust is a bit circular, isn’t it^^? Porting a fuzzer bug will hide the same class bug in the code it’s checking, who fuzzes the fuzzer / setup / harness:)? A good standard for rewrites is a differential testing, feed the same input to the old Go app and the new Rust then diff the outputs. Did you do that?
doc_ickabout 11 hours ago
Well the author “cannot simply dye my hair blue” so maybe they can’t confirm semantic equivalence or behavior? Poke aside (and unserious intro?) seems like a general and loose question of if the conversion can happen.

*be me over eager

aka-riderabout 10 hours ago
I consider a wig. I'm still on a fence with Rust at this point. see comments above
vessenesabout 10 hours ago
The title is the worst part of the essay. Which is super interesting, to wit: fable's a very capable model when it comes to transforming concepts in and out of structural descriptions, and you can use it (along with a test suite I presume) to transpile a codebase. I wouldn't have thought to do this, but I think it makes sense, and I like it - it's using model intelligence at a few different steps for sensible things. Thanks for the writeup. De clickbait your title though or you'll keep getting clickbait rage responses :)
dilyevskyabout 1 hour ago
Ime it remains the best model for prototyping, sims, visualization etc throwaway scenarios. Just don’t look at the generated code if you just let it rip on the problem for hours ;) but that advice applies to any model unfortunately
aka-riderabout 9 hours ago
I'm glad you liked it. I was trying to keep both, the title and the content as straightforward as possible.

Another point is, Fable is reasonably cheap if you don't allow it to read or write.

vessenesabout 8 hours ago
Thank you. Yes I would like to hear more about that - I’d be interested to read details about limiting some of its native tool use.
exabrialabout 3 hours ago
The best language a program to be written in is the original.

Languages have conventions and best practices that aren’t portable.

We could port COBOL to c and do a crap ton of goto/jmps and make a

     BEGIN MESS
motbus3about 9 hours ago
Makes sense it would have been 6 USD in GLM 5.3?
aka-riderabout 8 hours ago
I doubt that it is possible with GLM.

I haven't played with GLM 5.3, only with 5.2, so I cannot say for sure.

GLM is at the level of Opus. Fable is something different entirely. It is capable of tracing the data flows of the app, I even tried it in a huge PHP codebase, it works.

PHP is a weird beast because it allows something like

    $v = 'SomeClass' + 'Controller'
    ... // and later
    new($v)

In other words, it could be hard to understand the code without running it, Fable reads this.

And another distinct feature of Fable — it is an amazing orchestrator. I prohibit it basically read and write, and it operates a swarm of haiku and sonnet.

ramon156about 10 hours ago
what did i read? genuinely? its only a few words, and even that had to be AI written. The topic in the title barely was mentioned.
aka-riderabout 10 hours ago
Human-written. I was trying to be short and straight to the point.

LLM-powered rewrites and huge refactors are better done using 1 additional step "convert the code to <something> that represents it best".

The simplest example is, for a CRUD app it can be swagger description. The more complex behaviour exhibit the app, the more raw information should be provided.

Like ontologies, "A is a child of B" model can derive and enforce that "B is a parent of A", and so on.

On top of that, I write that Fable is reasonably cheap if one uses it solely for agent orchestration.

UltraSaneabout 10 hours ago
I found this part to be interesting/clever:

1. Extract the data representation

Ask the LLM to represent your code as any combination of:

    graphs
    ontologies
    hierarchical state machines
    UML process charts
    constraints
    math formulae
2 Operate on the representations

3 Convert representations back to code

richstokesabout 9 hours ago
Do we think that was necessary? What would have happened if OP had just asked it to rewrite and test/validate each piece as it went until everything is verified and complete?

My gut feeling is this is doing way too much, and it would've figured it out.

aka-riderabout 9 hours ago
this is the meat, yes.
brazukadevabout 9 hours ago
honestly it is hard to believe that seeing your replies and this heading: "The secret sauce".

Giving the benefit of doubt, we all might be writing a bit like claude nowadays.

If that is the case, I'd recommend reviewing the content before publishing to see if it sounds like a LLM.

Or if you are trying to create "better" AI slop and think that is enough to say the text is human-written, don't do that, just say it was AI-generated or assisted.

aka-riderabout 9 hours ago
I wrote this elsewhere. Reading so much LLM output may have affected how I write.

Probably I need some fresh air and a good fiction book.

whateveracctabout 2 hours ago
pangram says 100% human
cyanydeezabout 6 hours ago
And ROI of 0?