[swift-evolution] What about garbage collection?

Vanderlei Martinelli vmartinelli at alecrim.com
Mon Feb 8 23:04:30 CST 2016


Particularly I think the strong/weak dance, after understood and properly
applied, is a benefit and not a bad thing.

We can write things like:

doSomeLongRunningTaskThatCannotBeCancelled { [weak self] someText in
    self?.someLabel.text = someText
}

This is a very common case in Cocoa [Touch], I think. Using GC how could we
say: “hey, if the result comes in and I'm no longer here, just ignore it,
okay?”

I really like that RC and ARC are alive in Swift. Perhaps in the future we
have something better, yet I would still like to be able to write code like
the above. About GC: I do not know any good reasons to bring it to Swift.

-Van

On Tue, Feb 9, 2016 at 2:54 AM, Paul Ossenbruggen via swift-evolution <
swift-evolution at swift.org> wrote:

>
> On Feb 8, 2016, at 1:00 PM, Chris Lattner via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>
>    -
>    the closure capture syntax uses up an unreasonable amount of mindshare
>    just because of [weak self]
>
>
> I think that this specific point is solvable in others ways, but I’ll
> interpret this bullet as saying that you don’t want to worry about
> weak/unowned pointers.  I completely agree that we strive to provide a
> simple programming model, and I can see how "not having to think about
> memory management" seems appealing.
>
> I actually like RC, and don’t find it particularly problematic except in
> this one case…the closure case. If we could solve this one problem then I
> think the rest of it is fine. I don’t mind remembering to put a weak
> reference in for back pointers etc. The benefits of RC are great, and the
> introduction of ARC was a great mental burden lifted of developer’s minds.
> Just trying to explain and remember all the tricky rules around the closure
> capture would be nice to solve and would love to discuss that rather than
> garbage collection.
>
> - Paul
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160209/cafa53c8/attachment.html>


More information about the swift-evolution mailing list