[swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-05 Thread Trent Nadeau via swift-evolution
https://github.com/tanadeau/swift-evolution/blob/make-noescape-default/proposals/-make-noescape-default.md # Make non-escaping closures the default * Proposal: [SE-](-name.md) * Author: [Trent Nadeau](https://github.com/tanadeau) * Status: **Awaiting review** * Review manager: TBD ##

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-06 Thread Ben Rimmington via swift-evolution
Trent Nadeau wrote: > ### Imported C/Objective-C APIs > > Per the Core Team, most Cocoa closure/block parameters are escaping > (e.g., delegates). As such the Clang importer will automatically add > the `@escaping` annotation to closure/block parameters encountered in > imported Objective-C APIs u

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-07 Thread Brent Royal-Gordon via swift-evolution
> This proposal switches the default to be non-escaping and requires an > `@escaping` annotation if a closure argument can escape the function body. Is @escaping part of the function type syntax (like @autoclosure) or the parameter syntax (like inout)? It seems to me that there are places where

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-07 Thread Trent Nadeau via swift-evolution
@escaping would be part of the parameter type just as @noescape is today. Your foo(closure:) example wouldn't compile with my proposal, the same as today if you marked the parameter with @noescape. Non-escaping function parameters are only allowed to be called. They can't be assigned to variables.

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-07 Thread Brent Royal-Gordon via swift-evolution
> @escaping would be part of the parameter type just as @noescape is today. > Your foo(closure:) example wouldn't compile with my proposal, the same as > today if you marked the parameter with @noescape. Non-escaping function > parameters are only allowed to be called. They can't be assigned to

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-08 Thread John McCall via swift-evolution
> On Jun 7, 2016, at 7:25 PM, Brent Royal-Gordon via swift-evolution > wrote: >> @escaping would be part of the parameter type just as @noescape is today. >> Your foo(closure:) example wouldn't compile with my proposal, the same as >> today if you marked the parameter with @noescape. Non-escapi

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-09 Thread Trent Nadeau via swift-evolution
When would be a good time to actual put out a PR to the swift-evolution repo for this proposal? The feedback so far has been very light, but I'm not sure if that's because everyone's gearing up for WWDC, if there's little interest, or if it's uncontroversial. On Wed, Jun 8, 2016 at 1:17 PM, John M

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-09 Thread Jordan Rose via swift-evolution
I'm against this for library evolution reasons: if someone releases a version of their library that has a non-escaping closure and later discovers it needs to be escaping, they can't change it. IIRC the counterpoint to this is that people were probably implicitly relying on it being non-escapin

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-09 Thread John McCall via swift-evolution
> On Jun 9, 2016, at 3:17 PM, Trent Nadeau wrote: > When would be a good time to actual put out a PR to the swift-evolution repo > for this proposal? The feedback so far has been very light, but I'm not sure > if that's because everyone's gearing up for WWDC, if there's little interest, > or if

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-09 Thread John McCall via swift-evolution
> On Jun 9, 2016, at 3:43 PM, Jordan Rose via swift-evolution > wrote: > > I'm against this for library evolution reasons: if someone releases a version > of their library that has a non-escaping closure and later discovers it needs > to be escaping, they can't change it. > > IIRC the counter

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-09 Thread Jordan Rose via swift-evolution
> On Jun 9, 2016, at 16:10, John McCall wrote: > >> On Jun 9, 2016, at 3:43 PM, Jordan Rose via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> I'm against this for library evolution reasons: if someone releases a >> version of their library that has a non-escaping closure

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-09 Thread John McCall via swift-evolution
> On Jun 9, 2016, at 4:15 PM, Jordan Rose wrote: >> On Jun 9, 2016, at 16:10, John McCall > > wrote: >> >>> On Jun 9, 2016, at 3:43 PM, Jordan Rose via swift-evolution >>> mailto:swift-evolution@swift.org>> wrote: >>> >>> I'm against this for library evolution reasons

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-09 Thread Trent Nadeau via swift-evolution
Thanks for the very interesting design discussion so far. It's exactly what I was wanting to see :) I'm going to incorporate some of this in the next draft of the proposal. I'm also going to add that there should be an asUnsafeEscapingClosure(_:) helper that will convert a default/noescape closure

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-20 Thread Jose Cheyo Jimenez via swift-evolution
That proposal was rejected because the swift evolution is not the correct vehicle to drive changes to Apple frameworks. > On Jun 6, 2016, at 8:33 AM, Ben Rimmington via swift-evolution > wrote: > > Trent Nadeau wrote: > >> ### Imported C/Objective-C APIs >> >> Per the Core Team, most Coco

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-20 Thread Anton Zhilin via swift-evolution
Trent Nadeau via swift-evolution writes: > https://github.com/tanadeau/swift-evolution/blob/make-noescape- default/proposals/-make-noescape-default.md -1 from me. 1. One must break API and ABI compatibility to add @escaping to an existing function 2. @nonescaping case is actually quite as

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-20 Thread Joe Groff via swift-evolution
> On Jun 9, 2016, at 4:15 PM, Jordan Rose via swift-evolution > wrote: > >> >> On Jun 9, 2016, at 16:10, John McCall wrote: >> >>> On Jun 9, 2016, at 3:43 PM, Jordan Rose via swift-evolution >>> wrote: >>> >>> I'm against this for library evolution reasons: if someone releases a >>> vers

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-20 Thread Trent Nadeau via swift-evolution
I've created the PR for the proposal at https://github.com/apple/swift-evolution/pull/373. Thanks again to everyone that has discussed this so far. On Mon, Jun 20, 2016 at 8:18 PM, Joe Groff via swift-evolution < swift-evolution@swift.org> wrote: > > > On Jun 9, 2016, at 4:15 PM, Jordan Rose via

Re: [swift-evolution] [Proposal] Make non-escaping closures the default

2016-06-21 Thread John McCall via swift-evolution
> On Jun 20, 2016, at 11:24 AM, Anton Zhilin via swift-evolution > wrote: > Trent Nadeau via swift-evolution writes: > >> https://github.com/tanadeau/swift-evolution/blob/make-noescape- > default/proposals/-make-noescape-default.md > > -1 from me. > > 1. One must break API and ABI compati