[Issue 11880] Reserve the keyword "yield"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 8 03:06:14 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11880



--- Comment #4 from bearophile_hugs at eml.cc 2014-01-08 03:06:11 PST ---
(In reply to comment #2)

> As I understand, "yield" doesn't need to be a keyword - it can be implemented
> as a language construct.

Do you have an example usage syntax (and implementation)? And is it going in
Phobos?

What about Issue 5660 ?


> The only limitation is that coroutines need to be
> started explicitly (which I think this is a plus as it improves readability).

This is the syntax I suggested, I think it's readable. What's the more readable
usage syntax that you suggest?


yield(int) foo() {
    yield 1;
    yield 2;    
}
void main() {
    import std.stdio, std.algorithm;
    foo.map!(x => x).writeln;
}

-- 
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