[swift-evolution] Passing an optional first argument to sequence(first:next:)

Dave Abrahams dabrahams at apple.com
Thu Aug 25 10:02:53 CDT 2016


on Sun Aug 14 2016, Tim Vermeulen <swift-evolution at swift.org> wrote:

> sequence(first:next:) takes a non-optional first argument. Is there a
> reason for that? 

Yes; it's understandable and fits many common use cases.

> sequence(state:next:) allows empty sequences, and I don’t see why
> sequence(first:next:) shouldn’t. 

The question is, what's the use case?  What user code would be
simplified by complicating the API and implementation?

> The fix would be to simply add the `?` in the function signature; no
> other changes are required to make it work.
>
> I considered just filing a bug report, but since this is a change of the public API...


-- 
-Dave



More information about the swift-evolution mailing list