[swift-evolution] [Pitch] Remove destructive consumption from Sequence
Dave Abrahams
dabrahams at apple.com
Fri Jul 1 09:47:37 CDT 2016
on Fri Jul 01 2016, Haravikk <swift-evolution-AT-haravikk.me> wrote:
>> On 30 Jun 2016, at 23:39, Dave Abrahams <dabrahams at apple.com> wrote:
>> All multi-pass sequences can benefit from subscripts.
>
> Sorry, not really what I meant, but rather; how many sequences are
> really going to use them?
The subscript and index aren't there for the sequence's benefit, and you
can't know how users will want to use the sequence. The whole point of
making a type conform to a generic protocol is that you can't anticipate
all of the type's uses, so you want to make it work with as much other
code as possible. If I'm defining a new sequence type, how can I know
whether someone might want to use index(of:) or slicing on it?
--
Dave
More information about the swift-evolution
mailing list