Thank you all for the information! I don’t know the language well enough to appreciate all the points in the RFC yet but that will come I guess. The only point mentioned in the emails I disagree with so far is the one about which default to use (as in keys or values for maps) since this choice is already made by whatever “.iter()” is set to. Unless “.iter()” is not guaranteed to exist for all collections in which case there is additional confusion and lookup required on the part of the user.
> On 01 Jan 2015, at 19:36, Masklinn <maskl...@masklinn.net> wrote: > > It'll use both somehow since it can't break existing code. Either by > having iterators be iterables (that's how python does it) or by > iterating iterables desugaring to iterating the corresponding iterator. > > On 2015-01-01, at 15:54 , Ryan Hiebert <r...@ryanhiebert.com> wrote: > >> I asked why there wasn't an Iterable trait in rust, for just this reason, >> and was informed that the trait would require higher kinded types. I suspect >> that once those arrive (sometime after 1.0) that for loops may change to use >> Iterable instead of Iterator. >> >> Sent from my iPhone >> >>> On Jan 1, 2015, at 4:49 AM, Pim Schellart <p.schell...@gmail.com> wrote: >>> >>> Dear Rust developers, >>> >>> I have just started using rust so this is obviously a stupid question but I >>> was wondering why .iter() is needed when looping over the elements of an >>> array? In the following example: >>> >>> let a = [1i, 2i, 3i]; >>> >>> for e in a.iter() { >>> println!("{}", e); >>> } >>> >>> why can’t one simply write: >>> >>> let a = [1i, 2i, 3i]; >>> >>> for e in a { >>> println!("{}", e); >>> } >>> >>> and have the compiler figure out that ‘a’ has ‘.iter()’ and use it? The >>> form without .iter() just feels more natural to me in this case. >>> Please feel free to tell me to RTFM or ask this question elsewhere. >>> >>> Regards, >>> >>> Pim >>> _______________________________________________ >>> Rust-dev mailing list >>> Rust-dev@mozilla.org >>> https://mail.mozilla.org/listinfo/rust-dev >> _______________________________________________ >> Rust-dev mailing list >> Rust-dev@mozilla.org >> https://mail.mozilla.org/listinfo/rust-dev > > _______________________________________________ > Rust-dev mailing list > Rust-dev@mozilla.org > https://mail.mozilla.org/listinfo/rust-dev _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev