[swift-evolution] [Pitch] Limit Implicit Capture

Haravikk swift-evolution at haravikk.me
Wed Mar 16 17:55:41 CDT 2016


> On 16 Mar 2016, at 19:37, Joe Groff <jgroff at apple.com> wrote:
>> What about “capture” as the keyword? This will require a new name for capture lists, but it seems like it isn’t well named at the moment anyway if it’s effectively copying values right now.
>> 
>> I’m also curious about thoughts regarding making implicit capture opt-in by default, vs the original proposals opt-out solution. Obviously this will require a good solution to the capture lists to replace the functionality and/or an attribute to opt-in to the current implicit behaviour, but I think it’s safer for it to be opt-in rather than the default.
> 
> I suspect that by far the most common use for capture lists is to declare [(weak|unowned) self]. I don't think we want to punish that use case.


capture could remain implicit for weak/unowned. Actually anything else for weak/owned may actually be meaningless (if you create a weak reference to a new copy of a value type then it’s just going to be nil I think, I could be mistaken).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160316/476704dd/attachment.html>


More information about the swift-evolution mailing list