It'd be interesting to see if we can add some sort support for
generator functions / yield functions to the language. As I believe we
currently can only have a callback-style generator in which we have to
manage the generator's state ourselves. It would be great to be able to
use `yield` and not have to manage the state manually.
--Bouke
On 2015-12-13 22:32:06 +0000, Chris Lattner said:
On Dec 12, 2015, at 12:35 PM, Douglas Gregor via swift-evolution
<swift-evolution at swift.org> wrote:
On Dec 11, 2015, at 10:48 PM, Kevin Ballard via swift-evolution
<swift-evolution at swift.org <mailto:swift-evolution at swift.org>>
wrote:
I'd love to have first-class support for generators like this, but it's
a lot of work. It's a lot easier to do this sort of thing in a
scripting language like Python than it is to do in a language like
Swift, because it requires reifying the stack into a data structure
that can be passed around. And I suspect there's a lot of non-trivial
questions that have to get answered before you can even propose an
implementation for this.
For context, this sort of thing is something that people have been
talking about doing in Rust for quite a while, and it keeps getting
punted because of the amount of work and the unanswered questions about
how it would actually be implemented.
So I'll give this a general +1, but I think it should also be deferred
until after Swift 3 at the earliest.
Right. This is a major add-on feature that doesnât fit in with the
stated goals for Swift 3 (README of
https://github.com/apple/swift-evolution
<https://github.com/apple/swift-evolution>), so I think we should
proactively defer it.
I agree with both of you. Iâm very interested in this, but it is
clearly out of scope for Swift 3. It should also be considered
alongside whatever async/concurrency approach we tackle (likely in
swift 4).
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<https://lists.swift.org/pipermail/swift-evolution/attachments/20151213/4d8e5a36/attachment.html>
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution