[swift-evolution] [Idea] NonEmptyArray
Charlie Monroe
charlie at charliemonroe.net
Tue Jan 17 03:40:32 CST 2017
I've come across multiple cases, where you simply know the array is never empty and hence the optionality on first, last and behavior of a few other members is slightly different. Also, there are cases where you want to declare that you shouldn't pass an empty array e.g. into an initializer.
I was wondering whether Swift could have a specialized NonEmptyArray that could be used throughout the stdlib - e.g. String.components(separatedBy:) would return NonEmptyArray.
Thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170117/9c4daf8d/attachment.html>
More information about the swift-evolution
mailing list