[Issue 5660] yield syntax sugar
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 7 18:32:15 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=5660
--- Comment #10 from bearophile_hugs at eml.cc 2014-01-07 18:32:09 PST ---
I think a "yield" with an usage syntax like this (semantically similar to the
Python "yield") that's syntax sugar for a ForwardRange is a good and handy
addition to the language:
yield(int) foo() {
yield 1;
yield 2;
}
void main() {
import std.stdio, std.algorithm;
foo.map!(x => x).writeln;
}
See also for an improvement:
http://www.python.org/dev/peps/pep-0380/
That explains the desire for also a "yield foreach" (this is not a replacement
for "yield", it's an addition):
yield(int) bar() {
yield foreach foo();
}
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list