[swift-evolution] [Pitch] Remove destructive consumption from Sequence
pgwsmith at gmail.com
Thu Jun 23 00:19:05 CDT 2016
There’s a great discussion going on here, and I don’t mean to distract. But I want to ask: to get an infinite sequence using the Swift standard library, you’re going to have to create one yourself, say using the new `sequence()` functions? There’s nothing built in that is already infinite, so people will know what they are creating, that’s the explicit step, and there’s no need to have safety to infinitely loop over something. And if someone accidentally creates an unwanted infinite loop, that’s a fix in the creation of the sequence, not in its looping.
> On 23 Jun 2016, at 11:12 AM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
> Sure, it’s not wrong in the sense that sometimes an infinite loop is valid. But I think it would almost always be wrong (an accident) in practice. If you really want to loop over an infinite sequence maybe it’s a good thing to require you to do that explicitly.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution