Re: [swift-dev] No return functions and program exit

2017-02-07 Thread Michael Gottesman via swift-dev
> On Feb 7, 2017, at 11:56 AM, Andrew Trick wrote: > >> >> On Feb 6, 2017, at 12:19 PM, Michael Gottesman via swift-dev >> mailto:swift-dev@swift.org>> wrote: >> >> >>> On Feb 6, 2017, at 11:44 AM, Jordan Rose >> > wrote: >>> >>> On Feb 6, 2017, at 11:25,

Re: [swift-dev] No return functions and program exit

2017-02-07 Thread Andrew Trick via swift-dev
> On Feb 6, 2017, at 12:19 PM, Michael Gottesman via swift-dev > wrote: > > >> On Feb 6, 2017, at 11:44 AM, Jordan Rose > > wrote: >> >> >>> On Feb 6, 2017, at 11:25, Joe Groff via swift-dev >> > wrote: >>> >>> On Feb 6, 2017,

Re: [swift-dev] No return functions and program exit

2017-02-07 Thread Greg Parker via swift-dev
> On Feb 6, 2017, at 9:48 AM, Michael Gottesman via swift-dev > wrote: > > One thing that is an issue that has come up with ownership is that at the SIL > level we do not distinguish in between exceptional noreturn functions and > exceptional return functions. > > This is important since in

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Michael Gottesman via swift-dev
> On Feb 6, 2017, at 3:41 PM, Erik Eckstein wrote: > > I’m not sure if I understood. > What if there is a call to a function and that conditionally calls a noreturn > function: > > func foo() { > let x = Myclass() > bar(true) > // release x here? > } > > func bar(_ dontReturn: Bool) { >

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Erik Eckstein via swift-dev
I’m not sure if I understood. What if there is a call to a function and that conditionally calls a noreturn function: func foo() { let x = Myclass() bar(true) // release x here? } func bar(_ dontReturn: Bool) { if (dontReturn) { noreturn_func() } } Is it even possible to “clean up

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Michael Gottesman via swift-dev
> On Feb 6, 2017, at 11:44 AM, Jordan Rose wrote: > > >> On Feb 6, 2017, at 11:25, Joe Groff via swift-dev > > wrote: >> >> >>> On Feb 6, 2017, at 11:22 AM, Michael Gottesman >> > wrote: >>> >>> Here is my suggestion: >>> >>> 1. We as

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Jordan Rose via swift-dev
> On Feb 6, 2017, at 11:25, Joe Groff via swift-dev wrote: > > >> On Feb 6, 2017, at 11:22 AM, Michael Gottesman wrote: >> >> Here is my suggestion: >> >> 1. We assume by default the leaking case. >> 2. We change noreturn functions from C to maybe have a special semantic tag >> on them that

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread John McCall via swift-dev
> On Feb 6, 2017, at 2:25 PM, Joe Groff via swift-dev > wrote: >> On Feb 6, 2017, at 11:22 AM, Michael Gottesman wrote: >> >> Here is my suggestion: >> >> 1. We assume by default the leaking case. >> 2. We change noreturn functions from C to maybe have a special semantic tag >> on them that s

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Michael Gottesman via swift-dev
SGTM! Michael > On Feb 6, 2017, at 11:25 AM, Joe Groff wrote: > > >> On Feb 6, 2017, at 11:22 AM, Michael Gottesman wrote: >> >> Here is my suggestion: >> >> 1. We assume by default the leaking case. >> 2. We change noreturn functions from C to maybe have a special semantic tag >> on them

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Michael Gottesman via swift-dev
Here is my suggestion: 1. We assume by default the leaking case. 2. We change noreturn functions from C to maybe have a special semantic tag on them that says that cleanups should occur before them (i.e. UIApplicationMain). How does that sound? Michael > On Feb 6, 2017, at 11:08 AM, Joe Groff

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Joe Groff via swift-dev
> On Feb 6, 2017, at 11:22 AM, Michael Gottesman wrote: > > Here is my suggestion: > > 1. We assume by default the leaking case. > 2. We change noreturn functions from C to maybe have a special semantic tag > on them that says that cleanups should occur before them (i.e. > UIApplicationMain).

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Joe Groff via swift-dev
> On Feb 6, 2017, at 11:04 AM, Michael Gottesman wrote: > >> >> On Feb 6, 2017, at 10:04 AM, Joe Groff wrote: >> >> >>> On Feb 6, 2017, at 9:48 AM, Michael Gottesman via swift-dev >>> wrote: >>> >>> One thing that is an issue that has come up with ownership is that at the >>> SIL level w

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Michael Gottesman via swift-dev
> On Feb 6, 2017, at 10:04 AM, Joe Groff wrote: > > >> On Feb 6, 2017, at 9:48 AM, Michael Gottesman via swift-dev >> wrote: >> >> One thing that is an issue that has come up with ownership is that at the >> SIL level we do not distinguish in between exceptional noreturn functions >> and e

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Michael Gottesman via swift-dev
> On Feb 6, 2017, at 10:05 AM, Joe Groff wrote: > > >> On Feb 6, 2017, at 10:02 AM, Jordan Rose via swift-dev >> wrote: >> >> I’ve said this Michael in person, but I’ll put it on the thread for others >> to see: >> >> I don’t think modeling this is worth the increase in complexity. There’s

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Joe Groff via swift-dev
> On Feb 6, 2017, at 10:02 AM, Jordan Rose via swift-dev > wrote: > > I’ve said this Michael in person, but I’ll put it on the thread for others to > see: > > I don’t think modeling this is worth the increase in complexity. There’s a > partial workaround for anyone who notices this being a p

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Joe Groff via swift-dev
> On Feb 6, 2017, at 9:48 AM, Michael Gottesman via swift-dev > wrote: > > One thing that is an issue that has come up with ownership is that at the SIL > level we do not distinguish in between exceptional noreturn functions and > exceptional return functions. > > This is important since in

Re: [swift-dev] No return functions and program exit

2017-02-06 Thread Jordan Rose via swift-dev
I’ve said this Michael in person, but I’ll put it on the thread for others to see: I don’t think modeling this is worth the increase in complexity. There’s a partial workaround for anyone who notices this being a problem, which is to put any expensive work in a ‘do’ block. And actually emitting