I think re-implementing the functionality is the mistake here.
A big counter-argument to “rewrite in rust” is usually that by rewriting you introduce new bugs.
Especially for security critical things one should re-use the implementation to avoid issues like the above.
Proving both the original and re-implemented parser to be equivalent would probably also work, but not sure how practical.
And in any case have competent people audit what you did.
I’m not mocking it. I’m just applying the argument I see many people on HN make in discussions about rust to this case, where I suspect many will lean much more on the side of using regexes to reimplement parsers. Don’t know if that’ll be the same people. Either way, I didn’t want to have a discussion about rust.
> I’m not mocking it. I’m just applying the argument I see many people on HN make in discussions about rust to this case, where I suspect many will lean much more on the side of using regexes to reimplement parsers.
Hmm. Okay.
The part that bewilders me is that Rust showed up. Which would have made sense if someone was complaining about C++ or something, or maybe unsafe memory management. But regexes?
> Either way, I didn’t want to have a discussion about rust.
Which is why you brought it up unprompted... I give up.
Okay, I’ll give you one more thing: I love using rust. I also use zoxide, ripgrep, dua, etc.
I don’t hate the language. Quite the opposite. I hope you can now go back and just see the argument for what it is and not for what you thought I was insinuating.
Especially for security critical things one should re-use the implementation to avoid issues like the above. Proving both the original and re-implemented parser to be equivalent would probably also work, but not sure how practical.
And in any case have competent people audit what you did.