In fact, Java is looking to introduce value types and will have to wrestle with how to do it in a pure GC environment. For Swift a GC is lots of pain for minimal gain or even a net loss.<br><br>On Monday, February 8, 2016, Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
on Mon Feb 08 2016, Félix Cloutier <<a href="javascript:;" onclick="_e(event, 'cvml', 'swift-evolution@swift.org')">swift-evolution@swift.org</a>> wrote:<br>
<br>
> Has there been a garbage collection thread so far? I understand that<br>
> reference counting vs. garbage collection can be a heated debate, but<br>
> it might be relevant to have it.<br>
><br>
> It seems to me that the two principal upsides of reference counting<br>
> are that destruction is (essentially) deterministic and performance is<br>
> more easily predicted. However, it comes with many downsides:<br>
><br>
> object references are expensive to update<br>
> object references cannot be atomically updated<br>
> heap fragmentation<br>
> the closure capture syntax uses up an unreasonable amount of mindshare<br>
> just because of [weak self]<br>
><br>
> Since Swift doesn't expose memory management operations outside of<br>
> `autoreleasepool`, it seems to me that you could just drop in a<br>
> garbage collector instead of reference counting and it would work (for<br>
> most purposes).<br>
><br>
> Has a GC been considered at all?<br>
<br>
Yes. Among other problems, you can't do copy-on-write efficiently with<br>
a GC, because you can't detect a unique reference. And without<br>
efficient copy-on-write, most interesting value types (Array) are out<br>
the window.<br>
<br>
--<br>
-Dave<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'swift-evolution@swift.org')">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote>