News for hackers. Stuff that matters.
Re:Rust traits are a local maxima by dgfitz on Friday November 22, 2024 @08:53AM (#42213830)
> trait Iterator = fn next<T>(&mut self) -> Option<T> + fn len(&self) -> usize

This is why I don’t have interest in learning rust. When I see people write c++ code like this I wonder why they feel the need to be so clever.

That is an abysmal thing to maintain.

Re:Rust traits are a local maxima by steveklabnik on Friday November 22, 2024 @08:59AM (#42213879)
That isn’t real Rust code, though it’s made up of valid bits of Rust syntax.
Re:Rust traits are a local maxima by dgfitz on Friday November 22, 2024 @09:52AM (#42214277)
Oh, ok that’s fair. I guess I should at least learn the grammar better before commenting more on rust.
Re:Rust traits are a local maxima by marcosdumay on Friday November 22, 2024 @09:26AM (#42214067)
Nope, just because you lack familiarity with the symbols, it doesn't make that declaration complex.

It's not even "clever". It's completely plain, and the bare minimum and obvious definition of what an "iterator" should be.

Re:Rust traits are a local maxima by moomin on Friday November 22, 2024 @09:02AM (#42213898)
I mean, C#'s IEnumerator is equivalent and is way more complex. You just don't need to think about it much.