<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div><br></div><div><br>On Oct 11, 2017, at 3:42 PM, Ben Cohen <<a href="mailto:ben_cohen@apple.com">ben_cohen@apple.com</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 11, 2017, at 1:15 PM, Kelvin Ma via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">there is no way to allow one-sided subscripting, but disallow two-sided subscripting for the memory API</span></div></blockquote></div><br class=""><div class="">One-sided subscripting is just shorthand for “from here to the end” (or from the start to/through here). If a one-sided subscript is just shorthand for a two-sided subscript there cannot be a circumstance where one is allowed but not the other. This kind of rule should be consistent throughout the library.</div></div></blockquote><div><br></div><div>You are entirely correct which is why i’m not comfortable with this syntax.</div><br><blockquote type="cite"><div><div class=""><br class=""></div><div class="">If a “from:” argument, similarly, means “write from here up to the end” (and no further, it’s reasonable to assume, if we’re talking about collections) then x.foo(from: i) is similar to saying x[i…].foo(), which in turn is similar to saying x[5..<x.endIndex].foo()</div><div class=""><br class=""></div></div></blockquote><div><br></div><div>from: in the buffer pointer API refers to the source buffer which contains a `count` property. it’s analogous to the count: argument in the plain pointer API.</div><br><blockquote type="cite"><div><div class="">Do you feel like a “from:” argument avoids implying there is a specific end point to the operation? That is, it might not get as far as x.endIndex if it runs out of stuff to write. Whereas x[i..<x.endIndex].foo() more implies “this will definitively replace the entire range from i to the end”?</div><div class=""><br class=""></div><div class="">(with x[i…].foo() living in an unpleasant grey-area)</div><div class=""><br class=""></div></div></blockquote><div><br></div>pretty much. We only want one "count" number floating around here so the behavior is easy to think about, and since the source buffer already contains a count we want the syntax to avoid implying a second quantity that might contradict `source.count` as much as possible.</body></html>