<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 13, 2016, at 1:43 PM, Joe Groff &lt;<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I see, missed that part. That's a bug—`acopy` should remain a distinct copy of `a`.</span><br style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote></div><br class=""><div class="">I’m guessing that when `a` is copied into `acopy`, the same array contents are shared between them, then when `a` is mutated it gets a new copy of the contents. Then the assignment to `b` writes into the original array contents now held by `acopy`.</div><div class=""><br class=""></div><div class="">Still seems like it’s caused by having aliased `inout` variables, but the effect is nastier. I can imagine horrible bugs where `acopy` gets passed around somewhere else and then changes, breaking the something-else that’s holding it. It could be hard to track that back to its original cause, especially if there are two different codebases involved.</div><div class=""><br class=""></div><div class="">—Jens</div></body></html>