digitalmars.D - Re: Why Ruby?
- bearophile <bearophileHUGS lycos.com> Dec 15 2010
Ary Borenszweig:D should provide a yield keyword that basically rewrites the body of the method into the first code. What's that "if (result) break;"? That's showing the implementation of foreach. Why do I have to rememebr the result of dg? What's that? What if I forget it? I just want to yield two elements :-(
Time ago I have asked for the "yield" syntax&semantics of Python in D too. It's just syntax sugar for opApply. A syntax like: yield(int) squares(int n) { foreach (i; 0 .. n) yield i * i; } Bye, bearophile
Dec 15 2010