<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 dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" 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 Feb 27, 2017, at 11:08 AM, John McCall &lt;<a href="mailto:rjmccall@apple.com" class="">rjmccall@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; 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=""><blockquote type="cite" class=""><div class="">On Feb 25, 2017, at 11:41 AM, plx via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">1: Collection Composition</div><div class=""><br class=""></div><div class="">As much as the high-level picture is focused on safety, I’d just like to request a strong focus on making sure the eventual ownership system addresses the common issues like avoiding copies when mutating through optionals, or when nesting collections, and so on.</div></div></div></blockquote><div class=""><br class=""></div>Avoiding copies is basically the entire core of the proposal. &nbsp;The interaction with safety is that sometimes copies are necessary to avoid memory unsafety, and this proposal recommends an approach that minimizes that.</div></div></blockquote><br class=""><div><div>Thanks for the extend reply and sorry for my own belated reply.</div><div><br class=""></div><div>What motivated me to ask for more focus on the common cases was that it was unclear from reading the proposal whether the `inout` binding--as used in `for inout`--could be used with `if`: in other words, we currently have `if let` and `if var`, but will we have `if inout` under this proposal?</div><div><br class=""></div><div>I am embarassed to admit I honestly couldn't tell if the proposal didn't contain any examples of `if inout` due to (a) the capability following trivially from the rest of the proposal or (b) the capability falling outside the scope of the proposal.</div><div><br class=""></div><div>If it's (a) I apologize and feel free to skip down to the next section, if it's (b) I'll reiterate my request to for more focus on streamlining the common cases. In particular it'd be nice if there was a relatively homogeneous syntax as sketched below:</div><div><br class=""></div><div>&nbsp;for related operations starts to diverge a bit:</div><div><br class=""></div><div>&nbsp; var dict: [K:Set&lt;V&gt;] = // ...</div><div>&nbsp;&nbsp;</div><div>&nbsp; // read-only uses `if-let` (or `if shared`?)</div><div>&nbsp; if let setForKey = dict[key] {</div><div>&nbsp; &nbsp; // read `setForKey`</div><div>&nbsp; }</div><div>&nbsp;&nbsp;</div><div>&nbsp; // simple in-place mutation</div><div>&nbsp; if inout setForKey = dict[key] {</div><div>&nbsp; &nbsp; setForKey.mutateSomehow()</div><div>&nbsp; }</div><div>&nbsp;&nbsp;</div><div>&nbsp; // compound "in-place" mutation&nbsp;</div><div>&nbsp; if inout setForKey = dict[key] {</div><div>&nbsp; &nbsp; setForKey.mutateSomehow()</div><div>&nbsp; &nbsp; setForKey.mutateSomeOtherWay()</div><div>&nbsp; }</div><div><br class=""></div><div>&nbsp; // simple "in-place" mutation w/follow-up</div><div>&nbsp; if inout setForKey = dict[key] {</div><div>&nbsp; &nbsp; setForKey.mutateSomehow()</div><div>&nbsp; &nbsp; let shouldRemove = setForKey.isEmpty</div><div>&nbsp; &nbsp; endScope(setForKey)</div><div>&nbsp; &nbsp; if shouldRemove {</div><div>&nbsp; &nbsp; &nbsp; dict.removeValue(forKey: key)</div><div>&nbsp; &nbsp; }</div><div>&nbsp; }</div><div><br class=""></div><div>&nbsp; // compound "in-place" mutation w/follow-up</div><div>&nbsp; if inout setForKey = dict[key] {</div><div>&nbsp; &nbsp; setForKey.mutateSomehow()</div><div>&nbsp; &nbsp; setForKey.mutateSomeOtherWay()</div><div>&nbsp; &nbsp; let shouldRemove = setForKey.isEmpty</div><div>&nbsp; &nbsp; endScope(setForKey)</div><div>&nbsp; &nbsp; if shouldRemove {</div><div>&nbsp; &nbsp; &nbsp; dict.removeValue(forKey: key)</div><div>&nbsp; &nbsp; }</div><div>&nbsp; }</div><div>&nbsp;&nbsp;</div><div>...which, again, all use approximately the same syntax for each of these scenarios.&nbsp;</div><div><br class=""></div><div>Contrast with what would be the ideal ways to write the above under the proposal AIUI:</div><div><br class=""></div><div>&nbsp; var dict: [K:Set&lt;V&gt;] = // ...</div><div>&nbsp;&nbsp;</div><div>&nbsp; // read-only uses `if-let` (or `if shared`?)</div><div>&nbsp; if let setForKey = dict[key] {</div><div>&nbsp; &nbsp; // read `setForKey`</div><div>&nbsp; }</div><div>&nbsp;&nbsp;</div><div>&nbsp; // simple in-place mutation</div><div>&nbsp; if let index = dict.index(of: key) {</div><div>&nbsp; &nbsp; dict.values[index].mutateSomehow()</div><div>&nbsp; }</div><div>&nbsp;&nbsp;</div><div>&nbsp; // compound "in-place" mutation, I</div><div>&nbsp; // shorter, less-efficent due to repeated lookup</div><div>&nbsp; if let index = dict.index(of: key) {</div><div>&nbsp; &nbsp; dict.values[index].mutateSomehow()</div><div>&nbsp; &nbsp; dict.values[index].mutateSomeOtherWay()</div><div>&nbsp; }</div><div><br class=""></div><div>&nbsp; // compound "in-place" mutation, II</div><div>&nbsp; // longer, more-efficent</div><div>&nbsp; if let index = dict.index(of: key) {</div><div>&nbsp; &nbsp; inout setForKey = &amp;dict.values[index]</div><div>&nbsp; &nbsp; setForKey.mutateSomehow()</div><div>&nbsp; &nbsp; setForKey.mutateSomeOtherWay()</div><div>&nbsp; }</div><div><br class=""></div><div>&nbsp; // simple "in-place" mutation w/follow-up, I</div><div>&nbsp; // longer, less-efficient due to repeated lookup</div><div>&nbsp; if let index = dict.index(of: key) {</div><div>&nbsp; &nbsp; dict.values[index].mutateSomehow()</div><div>&nbsp; &nbsp; if dict.values[index].isEmpty {</div><div>&nbsp; &nbsp; &nbsp; dict.remove(at: index)</div><div>&nbsp; &nbsp; }</div><div>&nbsp; }</div><div><br class=""></div><div>&nbsp; // simple "in-place" mutation w/follow-up, II</div><div>&nbsp; // longer, less-efficient due to repeated lookup</div><div>&nbsp; if let index = dict.index(of: key) {</div><div>&nbsp; &nbsp; inout setForKey = &amp;dict.values[index]</div><div>&nbsp; &nbsp; setForKey.mutateSomehow()</div><div>&nbsp; &nbsp; let shouldRemove = setForKey.isEmpty</div><div>&nbsp; &nbsp; endScope(shouldRemove)</div><div>&nbsp; &nbsp; if shouldRemove {</div><div>&nbsp; &nbsp; &nbsp; dict.remove(at: index)</div><div>&nbsp; &nbsp; }</div><div>&nbsp; }</div><div><br class=""></div><div>&nbsp; // compound "in-place" mutation w/follow-up, I</div><div>&nbsp; // longer, less-efficient due to repeated lookups</div><div>&nbsp; if let index = dict.index(of: key) {</div><div>&nbsp; &nbsp; dict.values[index].mutateSomehow()</div><div>&nbsp; &nbsp; dict.values[index].mutateSomeOtherWay()</div><div>&nbsp; &nbsp; if dict.values[index].isEmpty {</div><div>&nbsp; &nbsp; &nbsp; dict.remove(at: index)</div><div>&nbsp; &nbsp; }</div><div>&nbsp; }</div><div><br class=""></div><div>&nbsp; // compound "in-place" mutation w/follow-up, II</div><div>&nbsp; // longer, less-efficient due to repeated lookup</div><div>&nbsp; if let index = dict.index(of: key) {</div><div>&nbsp; &nbsp; inout setForKey = &amp;dict.values[index]</div><div>&nbsp; &nbsp; setForKey.mutateSomehow()</div><div>&nbsp; &nbsp; setForKey.mutateSomeOtherWay()</div><div>&nbsp; &nbsp; let shouldRemove = setForKey.isEmpty</div><div>&nbsp; &nbsp; endScope(shouldRemove)</div><div>&nbsp; &nbsp; if shouldRemove {</div><div>&nbsp; &nbsp; &nbsp; dict.remove(at: index)</div><div>&nbsp; &nbsp; }</div><div>&nbsp; }</div><div><br class=""></div><div>...where my concern is less about what how particular scenario winds up looking and more that there’s such variance *between* the scenarios, at least when compared to a hypothetical `if inout` construct.</div><div><br class=""></div><div>Again if `if inout` is actually part of the proposal I apologize for illustrating the consequence of its absence at such length.</div></div></div><div><div><br class=""></div></div><div><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; 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="">The technical obstacle to this is just that, so far, we've tried to make language features like for-loops use formal protocols.</div><div style="font-family: Helvetica; font-size: 12px; 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=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; 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="">An iteration protocol is going to have requirements like this:</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; generator iterate() -&gt; Element</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; mutating generator iterateMutable() -&gt; inout Element</div><div style="font-family: Helvetica; font-size: 12px; 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="">But there's no valid substitution that makes '(Key, inout Value)' equal either 'Element' or 'inout Element'. &nbsp;So we'd have to do some special to make this work.</div><div style="font-family: Helvetica; font-size: 12px; 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=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; 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="">That said, no, there's no intrinsic technical reason this can't be made to work.</div></div></blockquote><div><br class=""></div><div>The explanation of wanting to stick to formal protocols makes perfect sense. I don’t think this should be a show-stopper, but I do think it’ll be a common request for a subsequent enhancement.&nbsp;</div><div><br class=""></div><div>Even in the interim it seems quite feasible to emulate the capability in any concrete case with enough willingness to crank out boilerplate; thus e.g. if someone truly needs `for (index, inout value) in collection.enumerated()` or `for (a, inout b) in zip(as,bs)` it isn’t as if they’re entirely stuck.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; 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=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">3: Mutable Views</div></div></div></blockquote><div class=""><br class=""></div>It's not sensible to have a type that conditionally conforms to a protocol based on context. </div></div></blockquote><div><br class=""></div>That did indeed seem like a big ask!<br class=""><div><br class=""></div><div>I’ll put in an early request to consider&nbsp;</div><div><br class=""></div><div>&nbsp; @moveonly {</div><div>&nbsp; &nbsp; struct File { }&nbsp;</div><div>&nbsp; }</div><div><br class=""></div><div>…(or @scope(moveonly) or @context(moveonly) or @dialect(moveonly), etc.).</div><div><br class=""></div><div>It’s confusing that `moveonly` essentially applies “inward”—it flags the code *within* a scope as using different assumptions, etc.—in contrast to most of the modifiers like `open`, `final`, `mutating`, etc., apply “outward” (by e.g. describing how visible the code in the scope is from other scopes, etc.).</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp;However, the requirements of MutableCollection are all 'mutating', so you can't actually use them unless you have a mutable value. &nbsp;So the way to fit what you're asking for into the ownership proposal is to make sure that clients of your view type only have a mutable value when the base was mutable, and the easiest way of getting that is to have the view be vended as storage rather than a return value. &nbsp;If you think about it, a mutable view can't be an independent value anyway, because if code like this could work:</div><div style="font-family: Helvetica; font-size: 12px; 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=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; var grid = ... // note that this is mutable</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; var view = grid.traversal(from: p, following: m) // should return a mutable view by design, right?</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; view.mutate() // reflected in grid, right?</div><div style="font-family: Helvetica; font-size: 12px; 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=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; 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="">then it completely destroys the value-type properties of 'grid', because 'view' should really be an independent value.</div></div></blockquote><br class=""></div><div>Without belaboring this, the point is indeed to “destroy the value-type properties of `grid`”, while trying to keep things “safe” by quarantining `view`—and the temporary relaxation of value semantics its existence implies—to a specific scope; thus under the status quo the use-site looks like this:</div><div><br class=""></div><div><div>&nbsp; var grid = // note that this is mutable</div><div>&nbsp; // also note that `mutatingTraversal` is a `mutating` method...</div><div>&nbsp; grid.mutatingTraversal(from: c, following: m) {</div><div>&nbsp; &nbsp; (inout view: MutableGrid2DTraversal&lt;T&gt;) -&gt; Void</div><div>&nbsp; &nbsp; in</div><div>&nbsp; &nbsp; // ^ this is the only public method that vends `MutableGrid2DTraversal&lt;T&gt;`, and</div><div>&nbsp; &nbsp; // `MutableGrid2DTraversal&lt;T&gt;` has no public constructors, thus `view` is</div><div>&nbsp; &nbsp; // “quarantined” to this scope unless we actively attempt to leak `view`...</div><div>&nbsp; &nbsp; view.mutate()</div><div>&nbsp; }</div><div><br class=""></div><div>…which currently has two major drawbacks:</div><div><br class=""></div><div>- (a) lots of code duplication: the immutable `Grid2DTraversal&lt;T&gt;` and the mutable `Mutable2DTraversal&lt;T&gt;`</div><div>- (b) the “quarantine” isn’t airtight, in that there are at least these three ways a `view` could escape:</div><div><br class=""></div><div><div>&nbsp; var grid = // …</div><div>&nbsp; var leakedView: MutatingGrid2DTraversal&lt;T&gt;? = nil</div><div>&nbsp; var otherLeakedView = grid.mutatingTraversal(from: c, following: m) {</div><div>&nbsp; &nbsp; (inout view: MutableGrid2DTraversal&lt;T&gt;) -&gt; MutableGrid2DTraversal&lt;T&gt;</div><div>&nbsp; &nbsp; in</div><div>&nbsp; &nbsp; view.mutate()</div><div>&nbsp; &nbsp; // leak #1:</div><div>&nbsp; &nbsp; leakedView = view</div><div>&nbsp; &nbsp; // leak #2:</div><div>&nbsp; &nbsp; self.liveDangerously(leaking: view)</div><div>&nbsp; &nbsp; // leak #3:</div><div>&nbsp; &nbsp; return view</div><div>&nbsp; }</div><div class=""><br class=""></div></div><div>…which imho makes it fair to say “the above approach *encourages* ‘safe’ usage, but can’t *prevent* unsafe usage”.</div><div><br class=""></div><div>Under the ownership proposal nothing changes for drawback (a): to stick with the design and behavior sketched above requires distinct types and thus a lot of duplicate or near-duplicate boilerplate.</div><div><br class=""></div><div>Drawback (b) seems to fare better under the ownership proposal, provided that I make `MutatingGrid2DTraversal` a non-Copyable type; at least AIUI making `MutatingGrid2DTraversal` non-Copyable would effectively close leaks #1, #2, and #3, b/c:</div><div><br class=""></div><div>- I would explicitly have to write e.g. `leakedView = move(view)` (a *very* unlikely accident)</div><div>- I would also have to supply a "replacement value” for `view` by the end of the scope (impossible due to lack of public constructors)</div><div><br class=""></div><div>…at least if I understand correctly. Is this accurate? If accurate, how likely would it be that “failed to provide replacement value for `view` after move” would get caught at compile time?</div><div><br class=""></div><div>Thanks again for providing such detailed clarifications about this proposal.</div><div><br class=""></div></div><div><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; 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="">The proposal suggests doing this instead with storage, so that the view is logically a (mutable) component of the grid. &nbsp;So on the use side:</div><div style="font-family: Helvetica; font-size: 12px; 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=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; var grid = ...</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; inout view = &amp;grid[traversingFrom: p, following: m]</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; view.mutate()</div><div style="font-family: Helvetica; font-size: 12px; 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=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; 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="">and on the declaration side:</div><div style="font-family: Helvetica; font-size: 12px; 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=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; struct Grid2D&lt;T&gt; {</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; &nbsp; subscript(traversingFrom corner: Grid2DCorner, following motion: Grid2DMotion) -&gt; Grid2DTraversal&lt;T&gt; {</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; &nbsp; &nbsp; read {</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; &nbsp; &nbsp; &nbsp; yield Grid2DTraversal(...)</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; &nbsp; &nbsp; }</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; &nbsp; &nbsp; modify {</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; &nbsp; &nbsp; &nbsp; var traversal = Grid2DTraversal(...)</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; &nbsp; &nbsp; &nbsp; yield &amp;traversal</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; &nbsp; &nbsp; &nbsp; // ensure changes were applied here</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; &nbsp; &nbsp; }</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; &nbsp; }</div><div style="font-family: Helvetica; font-size: 12px; 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="">&nbsp; }</div><div style="font-family: Helvetica; font-size: 12px; 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=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; 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="">If you feel that the aesthetics of this leave something to be desired, that's a totally reasonable thing to discuss.</div></div></blockquote><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; 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=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; 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="">John.</div><div style="font-family: Helvetica; font-size: 12px; 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=""><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><br class=""></div><div class="">Anyways, it’s not clear to me, personally, whether or not the above is within the scope of any likely, concrete ownership system that’d follow from the manifesto or not…but if at all possible I’d prefer the eventual ownership system make it reasonable—and reasonably safe—to implement “small-c ‘collection’s that can safely-and-efficiently expose various *mutable* views as big-C `Collection`s”.</div><div class=""><br class=""></div><div class="">Apologies if all of the above considerations have answers that follow trivially from the manifesto; it’s just unclear personally whether the features described in the manifesto would work together to allow something like the above to be implemented more-reasonably than currently the case.</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 17, 2017, at 11:08 AM, John McCall 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=""><div class="" style="font-family: Helvetica; font-size: 12px; 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;"><blockquote type="cite" class="" style="margin: 15px 0px;"><div class="">On Feb 17, 2017, at 4:50 AM, Adrian Zubarev &lt;<a href="mailto:adrian.zubarev@devandartist.com" class="" style="color: rgb(65, 131, 196); background-color: inherit; text-decoration: none;">adrian.zubarev@devandartist.com</a>&gt; wrote:</div><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="bloop_markdown"><p class="" style="margin: 15px 0px; -webkit-margin-before: 0px;">Hi John, would you mind creating a markdown document for this manifesto in<span class="Apple-converted-space">&nbsp;</span><a href="https://github.com/apple/swift/tree/master/docs" class="" style="color: rgb(65, 131, 196); background-color: inherit; text-decoration: none; -webkit-margin-before: 0px;">https://github.com/apple/swift/tree/master/docs</a>? :)</p><div class=""><br class="" style="-webkit-margin-before: 0px;"></div></div></div></div></blockquote>Yes, it should go in the repository. &nbsp;That commit is pending, but the in meantime, you can see the document properly rendered at:</div><div class="" style="font-family: Helvetica; font-size: 12px; 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;">&nbsp;&nbsp;<a href="https://github.com/rjmccall/swift/blob/4c67c1d45b6f9649cc39bbb296d63663c1ef841f/docs/OwnershipManifesto.md" class="" style="color: rgb(65, 131, 196); background-color: inherit; text-decoration: none;">https://github.com/rjmccall/swift/blob/4c67c1d45b6f9649cc39bbb296d63663c1ef841f/docs/OwnershipManifesto.md</a></div><div class="" style="font-family: Helvetica; font-size: 12px; 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;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; 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;"><font face="Helvetica Neue, Helvetica, Arial, sans-serif" class="">John.</font></div><span class="" style="font-family: Helvetica; font-size: 12px; 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;">_______________________________________________</span><br class="" style="font-family: Helvetica; font-size: 12px; 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;"><span class="" style="font-family: Helvetica; font-size: 12px; 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;">swift-evolution mailing list</span><br class="" style="font-family: Helvetica; font-size: 12px; 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;"><span class="" style="font-family: Helvetica; font-size: 12px; 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;"><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class="" style="font-family: Helvetica; font-size: 12px; 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;"><span class="" style="font-family: Helvetica; font-size: 12px; 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;"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span></div></blockquote></div><br class=""></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div></div></blockquote></div><br class=""></div></div></body></html>