Re: [swift-dev] Reason for call only non-escaping parameter

2017-05-31 Thread John McCall via swift-dev
> On May 31, 2017, at 1:17 PM, Dimitri Racordon via swift-dev > wrote: > Thanks for your answer. > > I agree that it may not be the most useful feature (although I’m sure we > could find not-so-contrived yet useful use-cases). Anyway, I guess that > discussion would rather belong to the evolut

Re: [swift-dev] Reason for call only non-escaping parameter

2017-05-31 Thread Dimitri Racordon via swift-dev
Sorry, your answer was perfectly fine. I’m the one who did a poor job acknowledging it :) I totally see how semantic analysis of such lifetimes may represent a complex challenge. In fact, if I’m not mistaking, the “non-escapability” of `f` in `let f = c ? nonEscParam : escParam` isn’t even stat

Re: [swift-dev] Reason for call only non-escaping parameter

2017-05-31 Thread John McCall via swift-dev
> On May 31, 2017, at 12:21 PM, Dimitri Racordon via swift-dev > wrote: > Hi everyone, > > I failed to find the reason why Swift does not allows a non-escaping > parameter to be assigned to a local variable. Here is a minimal example: > > func f(_ closure: () -> Int) { > let a = closure >

Re: [swift-dev] Reason for call only non-escaping parameter

2017-05-31 Thread Dimitri Racordon via swift-dev
Thanks for your answer. I agree that it may not be the most useful feature (although I’m sure we could find not-so-contrived yet useful use-cases). Anyway, I guess that discussion would rather belong to the evolution list :) I was more wondering if there were situations where such local assignm

[swift-dev] Reason for call only non-escaping parameter

2017-05-31 Thread Dimitri Racordon via swift-dev
Hi everyone, I failed to find the reason why Swift does not allows a non-escaping parameter to be assigned to a local variable. Here is a minimal example: func f(_ closure: () -> Int) { let a = closure } I do understand that assigning a non-escaping closure to a variable whose lifetime exc