Re: [rust-dev] iter library

2012-04-28 Thread Joe Groff
On Apr 27, 2012, at 11:03 PM, Marijn Haverbeke mari...@gmail.com wrote: What Joe meant is that you could simply write multiple impls on the same type with different names for the various modes of iteration. impl of iter for maptype { ... } impl iter_keys of iter for maptype { ... }

[rust-dev] iter library

2012-04-27 Thread Niko Matsakis
I just pushed a rather different version of the iter library to master. The existing approach wasn't really working out. The new one is simpler, and I think it will work out quite well, especially as we start making better use of slices. It is also plays nicely with the `for` loop syntax.

Re: [rust-dev] iter library

2012-04-27 Thread Joe Groff
On Apr 27, 2012, at 7:05 PM, Niko Matsakis n...@alum.mit.edu wrote: Later, I would like to add str, map, and a variety of other types. For types (like str and map) where there are multiple possibilities for how to iterate, my plan is to use wrapper types like so: enum keysK,V,M:mapK,V

Re: [rust-dev] iter library

2012-04-27 Thread Niko Matsakis
On 4/27/12 8:02 PM, Joe Groff wrote: Is the wrapper type necessary? I thought named implementations were intended to allow multiple implementations without wrapping. Sorry if I didn't make my purpose clear. The wrapper type is to distinguish the different modes of iteration. For example,