3 ms·
In the example of Rust: items.iter().enumerate().filter(|(_, i)| cond(i)).map(|(idx, i)| Pointer::idx(i, path, idx)).collect() vs. Zig: while (i < cu
by AlienRobot 13d ago
In the example of Rust:
items.iter().enumerate().filter(|(_, i)| cond(i)).map(|(idx, i)| Pointer::idx(i, path, idx)).collect()
vs. Zig:
while (i < cursors.len) {
if (actual_index < arr.items.len) { cursors[i] = .{...}; i += 1; }
else iteration.remove(i);
}
I think you have to be a special kind of person to call Rust "more readable."
The thing about Rust is that if you can appreciate zero-cost abstractions on iterators then the language feels like the only right way to program. But many programmers either don't use this sort of programming at all, or don't care if it has a cost in languages like JS, Python, Java, etc.
Personally I like Zig a lot because it feels like you're doing low-level programming but without having to program C which is... well, https://xkcd.com/918/ https://xkcd.com/918/
- sgarland 13d agoTHANK YOU. I feel exactly the same way. https://news.ycombinator.com/item?id=49769812 https://news.ycombinator.com/item?id=49769812
- metaltyphoon 12d agoYou realize you can write the Rust version in the same way the Zig one too right?
- AlienRobot 12d agoI don't understand what you mean. The examples come from the article.