<div dir="ltr">+1, and +1 to first-class weak-supporting sets and hash tables.<div><br></div><div>Austin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 29, 2016 at 5:56 PM, Jordan Rose via swift-dev <span dir="ltr"><<a href="mailto:swift-dev@swift.org" target="_blank">swift-dev@swift.org</a>></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">Hi, everyone. What do you think about dropping support for 'weak' in struct properties? This would fix a semantic issue—'let' structs containing weak properties won't change out from under you—and (AFAICT) would make all values trivially movable, which is a great quality to have.<br><div><br></div><div>This wouldn't change local variables, top-level variables, or class properties, just structs. It <i>would</i> make having an array of weak references a little harder, but honestly we should have proper weak-supporting collections anyway; as I understand it the behavior you usually want is auto-compacting rather than leaving a hole. (Evidence: Cocoa has NSHashTable for weak sets and NSMapTable for dictionaries with weak keys and/or values; there's no variant of NSArray that supports weak references other than by making a custom CFArray and being very very careful how you access it.)</div><div><br></div><div>Anyway, thoughts? It's not really my department but it cleans up the same areas that are being affected by struct resilience.</div><span class="HOEnZb"><font color="#888888"><div>Jordan</div></font></span><div><br></div><div>P.S. I know this would have to go through swift-evolution for real. I just want to know if it's a silly idea to begin with.</div></div><br>_______________________________________________<br>
swift-dev mailing list<br>
<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-dev" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-dev</a><br>
<br></blockquote></div><br></div>