> On Jan 22, 2017, at 15:40, Chris Lattner via swift-evolution > <[email protected]> wrote: > Right, the only sensible semantics for a one sided range with an open end > point is that it goes to the end of the collection. I see a few different > potential colors to paint this bikeshed with, all of which would have the > semantics “c[i..<c.endIndex]”: > > 1) Provide "c[i...]": > 2) Provide "c[i..<]": > 3) Provide both "c[i..<]” and "c[i…]": > > Since all of these operations would have the same behavior, it comes down to > subjective questions: > > a) Do we want redundancy? IMO, no, which is why #3 is not very desirable. > b) Which is easier to explain to people? As you say, "i..< is shorthand for > i..<endindex” is nice and simple, which leans towards #2. > c) Which is subjectively nicer looking? IMO, #1 is much nicer > typographically. The ..< formulation looks like symbol soup, particularly > because most folks would not put a space before ]. > > There is no obvious winner, but to me, I tend to prefer #1. What do other > folks think?
I also prefer #1. It’s a shame that this conflicts with the potential syntax for variadic generics. Is there really no way around this? I’m showing my ignorance on compilers here, but couldn’t the fact that variadic generics will be inside angle brackets be used to distinguish? -Matt
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
