Hacker News new | past | comments | ask | show | jobs | submit login

Isn’t the only real difference that the yield function is being passed into the iterator instead of being a reserved word? I don’t think it’s clunky, although it took a few minutes for me to get it.



In C#, `yield` is a kind of return, not a function call. The two approaches to iteration are quite different (external vs internal iteration).


No, before C# got generators, some of the machinery had to be manually implemented, with yeld, the compiler generates the necessary implementation for IEnumerable.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: