<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 11, 2015, at 18:20 , Andrey Tarantsov <<a href="mailto:andrey@tarantsov.com" class="">andrey@tarantsov.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Another possible syntax, inspired by "throws".</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">func foo() yield -> String</div></blockquote></div></div></blockquote><div class=""><br class=""></div><div class="">Well, again, yielding is an implementation detail. What's the advantage vs returning Generator<String>? I don't think that lying about the return type is useful for anyone.</div></div></div></div></blockquote></div><br class=""><div class="">Well, just returning "Generator<String>" doesn't distinguish this from a normal function that just returns a generator. Also, "Generator" is a protocol with an associated type, so you can't use it as a value type (yet?). Today you'd have to manually type-erase using the AnyGenerator wrapper. That also makes it harder to optimize, since clients won't know what kind of generator you're using. (Maybe that's a feature, though; it lets you change the implementation in the future. I guess it could make sense to have the interface show the "real" generator return type even if the source shows the element type.)</div><div class=""><br class=""></div><div class="">Jordan</div></body></html>