Did not know you could do that. Still doesn’t change the fundamental problems with that syntax though. I think that we could enforce a precondition that overrunning the left hand slice is not allowed, but idk if subscript notation is worth all that trouble.
On Thu, Oct 12, 2017 at 3:36 AM, Ole Begemann <[email protected]> wrote: > > On 12. Oct 2017, at 01:17, Kelvin Ma via swift-evolution < > [email protected]> wrote: > > On Wed, Oct 11, 2017 at 6:06 PM, Nevin Brackett-Rozinsky <nevin. > [email protected]> wrote: > >> On Wednesday, October 11, 2017, Kelvin Ma via swift-evolution < >> [email protected]> wrote: >> >>> Yes, a 0-ary operator like that would have to be hard baked into the >>> language itself. >>> >> >> Actually, you can just make a subscript which takes a function as an >> argument, and call it by passing in the ellipsis operator. >> > > I mean,,, you can,,, but that’s kind of weird > > > That's exactly how the [...] notation is implemented in the stdlib. Toni > Suter wrote a great article about it: https://tonisuter.com/ > blog/2017/08/unbounded-ranges-swift-4/ > >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
