|
|
|
|
|
by tialaramex
1495 days ago
|
|
But this Rust port isn't idiomatic Rust, so it doesn't take much advantage of the improved idiom. Its authors call that out early. Example: In C you're obliged to write a lot of counter loops, because the language does not have iterators, the idiomatic Rust is both smaller and easier to read because the counters weren't really for anything, they're just implementation details: for (k=0; k< size(geese); ++k) // We need this k counter in C to index geese
for goose in geese // In Rust we can just have the geese themselves
But if you do a non idiomatic port, you carry across that loop as it was written, plus you gain the extra conversion noise. So this is a much less useful metric.
|
|
The C line is more complex and less abstract, but that doesn't affect the lines-of-code metric that was being used in the discussion.