r/Compilers • u/Mean-Decision-3502 • Jun 12 '26
Code Readability Comparison
/r/programmer/comments/1u3x0z8/code_readability_comparison/
0
Upvotes
r/Compilers • u/Mean-Decision-3502 • Jun 12 '26
View all comments
3
u/matthieum Jun 12 '26
Everything is readable in small examples.
What matters is that a language remain mutable at scale:
Your Rust code is completely unidiomatic, so it's a bogus comparison:
black_boxfor???Rewritten, with inline comments explaining the choices for folks not used to Rust:
There is no pointer version, because nobody sane would use a pointer version. Pointers are to be used sparingly in Rust, as each use must be carefully annotated with comments discharging soundness obligations.
(I mean, ideally it should be the same in C or C++, but they're so omnipresent it would be untenable...)