<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On Apr 19, 2017, at 12:10 PM, Paweł Wojtkowiak via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; 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="">Maybe writing s[s.startIndex..&lt;i] isn't the worst thing, but writing classA.structB.stringC[classA.structB.stringC.startIndex..&lt;i] is not beautiful or easy to read at all, and sometimes it can get really complex. Of course, you can assign these to variables first and then use them</span></div></blockquote></div><div class=""><br class=""></div><div class="">You don't even really have *that* option for mutating operations. There, you'd need to do something like:&nbsp;</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>func withMutable&lt;T, Result&gt;(_ value: inout T, do body: (inout T) throws -&gt; Result) rethrows -&gt; Result {</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">                </span>return try body(&amp;value)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>withMutable(&amp;classA.structB.stringC) { c in</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>c[c.startIndex..&lt;i] &nbsp;= …</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; font-variant-ligatures: normal; font-variant-east-asian: normal; font-variant-position: normal; line-height: normal; border-spacing: 0px;"><div class=""><div style="font-size: 12px; " class="">--&nbsp;</div><div style="font-size: 12px; " class="">Brent Royal-Gordon</div><div style="font-size: 12px; " class="">Architechies</div></div></span>

</div>
<br class=""></body></html>