<div dir="ltr">yeah, which is why I think the <span style="font-family:monospace,monospace">at:from:</span> system is better than any subscript alternative. I know everyone wants to use the square brackets but it just doesn’t work very well for exactly the reasons you mentioned.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 30, 2017 at 6:07 PM, Dave Abrahams <span dir="ltr">&lt;<a href="mailto:dabrahams@apple.com" target="_blank">dabrahams@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div class="h5"><br><div><br><blockquote type="cite"><div>On Sep 29, 2017, at 4:03 PM, Taylor Swift &lt;<a href="mailto:kelvin13ma@gmail.com" target="_blank">kelvin13ma@gmail.com</a>&gt; wrote:</div><br class="m_-5832259184978187411Apple-interchange-newline"><div><div dir="auto"><div></div><div><br></div><div><br>On Sep 29, 2017, at 5:56 PM, Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com" target="_blank">dabrahams@apple.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><br><div><br><blockquote type="cite"><div>On Sep 29, 2017, at 3:48 PM, Taylor Swift &lt;<a href="mailto:kelvin13ma@gmail.com" target="_blank">kelvin13ma@gmail.com</a>&gt; wrote:</div><br class="m_-5832259184978187411Apple-interchange-newline"><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 29, 2017 at 4:13 PM, Andrew Trick <span dir="ltr">&lt;<a href="mailto:atrick@apple.com" target="_blank">atrick@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><span><br><div><br><blockquote type="cite"><div>On Sep 29, 2017, at 1:23 PM, Taylor Swift &lt;<a href="mailto:kelvin13ma@gmail.com" target="_blank">kelvin13ma@gmail.com</a>&gt; wrote:</div><br class="m_-5832259184978187411m_1404466990729912635Apple-interchange-newline"><div><blockquote class="gmail_quote" 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;margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div>Instead of</div><div><br></div><div> <span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span>buf.intialize(at: i, from: source)</div><div><br></div><div>We want to force a more obvious idiom:</div><div><br></div><div> <span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span>buf[i..&lt;n].intialize(from: source)</div><div><br></div></div></div></div></blockquote><div 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"><br></div><div 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">The problem with subscript notation is we currently get the<span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span><span style="font-family:monospace,monospace">n</span><span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span>argument from the<span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span><span style="font-family:monospace,monospace">source</span><span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span>argument. So what would really have to be written is<span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span><br></div><div 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"><br></div><div 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"><span style="font-family:monospace,monospace">buf[i ..&lt; i + source.count].initialize(from: source)<span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span></span><br></div><div 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"><br></div><div 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">which is a lot more ugly and redundant. One option could be to decouple the count parameter from the length of the source buffer, but that opens up the whole can of worms in which length do we use? What happens if<span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span><span style="font-family:monospace,monospace">n - i</span><span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span>is less than or longer than<span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span><span style="font-family:monospace,monospace">source.count</span>? If we enforce the precondition that<span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span><span style="font-family:monospace,monospace">source.count == n - i</span>, then this syntax seems horribly redundant.<span class="m_-5832259184978187411m_1404466990729912635Apple-converted-space"> </span></div></div></blockquote></div><br></span><div>Sorry, a better analogy would have been:</div><div><br></div><div><div style="word-wrap:break-word;line-break:after-white-space"><div><div><div> buf[i...].intialize(from: source)</div><div><br></div><div>Whether you specify the slice’s end point depends on whether you want to completely initialize that slice or whether you’re just filling up as much of the buffer as you can. It also depends on whether `source` is also a buffer (of known size) or some arbitrary Sequence.</div><div><br></div><div>Otherwise, point  taken.</div><div><br></div><div>-Andy</div></div></div></div></div></div></blockquote><div><br></div><div>After thinking about this more, one-sided ranges might provide just the expressivity we need. What if:</div><div><br></div><div><span style="font-family:monospace,monospace"> buf[offset...].initialize(<wbr>from: source) // initializes source.count elements from source starting from offset</span></div><div><span style="font-family:monospace,monospace"><br></span></div><div><span style="font-family:monospace,monospace">buf[offset ..&lt; endIndex].initialize(from: source) // initializes up to source.count elements from source starting from offset<br></span></div><div><br></div><div><br></div></div>The one sided one does not give a full initialization guarantee. The two sided one guarantees the entire segment is initialized. </div></div></div></blockquote><div><br></div><div>In every other context, x[i...] is equivalent to x[i..&lt;x.endIndex]</div><div><br></div><div>I don&#39;t think breaking that precedent is a good idea.</div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra">For move operations, the one sided one will fully deinitialize the source buffer while the two sided one will only deinitialize <span style="font-family:monospace,monospace">endIndex - offset</span> elements. <br></div></div>
</div></blockquote></div><br><div>
—<br>-Dave<br></div></div></blockquote><br><div>well since people want to use subscript notation so much we need some way of expressing case 1. writing both bounds in the subscript seems to imply a full initialization (and thus partial movement) guarantee.</div></div></div></blockquote><br></div></div></div><div>Yes, I understood your reasoning.  Do you understand why I still don&#39;t want to proceed in that direction?</div><br><div>
—<span class="HOEnZb"><font color="#888888"><br>-Dave<br><br><br><br><br>
</font></span></div>
<br></div></blockquote></div><br></div>