Rust switches to external iteration

w0rp devw0rp at gmail.com
Thu Jul 4 00:22:22 PDT 2013


> In the future, Rust can have generators using a `yield` 
> statement like C#,
>  compiling down to a fast state machine without requiring 
> context switches,
>  virtual functions or even closures. This would eliminate the 
> difficulty of
>  coding recursive traversals by-hand with external iterators.

It would be nice to beat them to the punch on this. Yield is a 
great tool. You can implement not so bad yield-like behaviour 
yourself in D, though. I have an old example that I baked up a 
while ago.

http://pastebin.com/EGqLHk0U

I'd prioritise important matters like improving the garbage 
collector and other non-language changing, but definitely 
beneficial improvements, over a big language addition like yield, 
though.


More information about the Digitalmars-d mailing list