Whole-known-network
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@whitequark" class="u-url mention">@<span>whitequark</span></a></span> That's helpful, thanks</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> to a first approximation, borrows are tracked on statement basis, not expression basis</p><p>so where you put semicolons is quite important</p><p>(this is an oversimplified model)</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@whitequark" class="u-url mention">@<span>whitequark</span></a></span> <span class="h-card" translate="no"><a href="https://discuss.systems/@pkhuong" class="u-url mention">@<span>pkhuong</span></a></span> mmm… i misread what this was doing</p>
<p>I am writing Rust.</p><p>The code on the left compiles.</p><p>The code on the right does not compile. It produces the error on the righter right.</p><p>Why? how is it possible that rearranging code like this could make such a substantial difference?</p><p>My assumption is in a C-shaped languages expressions are executed from inner to outer. Neither of the types of the self. functions return a reference type.</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> <span class="h-card" translate="no"><a href="https://discuss.systems/@pkhuong" class="u-url mention">@<span>pkhuong</span></a></span> the index array?</p>
<p><span class="h-card" translate="no"><a href="https://discuss.systems/@pkhuong" class="u-url mention">@<span>pkhuong</span></a></span> <span class="h-card" translate="no"><a href="https://mastodon.social/@whitequark" class="u-url mention">@<span>whitequark</span></a></span> Thanks… should this be expected to misbehave if the index array contains duplicates?</p>
<p><span class="h-card" translate="no"><a href="https://discuss.systems/@pkhuong" class="u-url mention">@<span>pkhuong</span></a></span> <span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> oh wiiild this is super useful thanks :D</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@whitequark" class="u-url mention">@<span>whitequark</span></a></span> <span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> Or <a href="https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_slice_of_cells" target="_blank" rel="nofollow noopener noreferrer" translate="no"><span class="invisible">https://</span><span class="ellipsis">doc.rust-lang.org/std/cell/str</span><span class="invisible">uct.Cell.html#method.as_slice_of_cells</span></a></p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@mcc" class="u-url mention">@<span>mcc</span></a></span> split_mut i suspect</p>