Re: [swift-evolution] Property Getter Return Statement

2017-10-18 Thread James Valaitis via swift-evolution
I am going to try to learn how to implement this and submit a proper proposal. > On 7 Oct 2017, at 15:07, James Valaitis wrote: > > Is it widely agreed that it is necessary to require a return statement on a > one line property getter? > > var session: AVCaptureSession

Re: [swift-evolution] Property Getter Return Statement

2017-10-12 Thread Goffredo Marocchi via swift-evolution
Will this finally bring labels back everywhere (closures and stored functions too)? :D. On Thu, Oct 12, 2017 at 3:03 PM, Jeremy Pereira via swift-evolution < swift-evolution@swift.org> wrote: > > > > > > I’m minorly opposed, because it feels like a slippery slope. What about > function bodies?

Re: [swift-evolution] Property Getter Return Statement

2017-10-12 Thread Jeremy Pereira via swift-evolution
> > I’m minorly opposed, because it feels like a slippery slope. What about > function bodies? etc > > func foo() -> Int { 3 } // should this be allowed? Yes, why not? What is fundamentally different about a function body compared to a getter body (or a closure body ;-)) that means, if we

Re: [swift-evolution] Property Getter Return Statement

2017-10-11 Thread Mike Kluev via swift-evolution
On Tue Oct 10 15:02:37 CDT 2017 Slava Pestov spestov at apple.com wrote: >> I’m minorly opposed, because it feels like a slippery slope. What about function bodies? etc >> >> func foo() -> Int { 3 } // should this be allowed? a small -1 or even: func foo() { 3 } // Int return type inferred as

Re: [swift-evolution] Property Getter Return Statement

2017-10-10 Thread Slava Pestov via swift-evolution
> On Oct 10, 2017, at 1:00 PM, Slava Pestov wrote: > >> >> On Oct 9, 2017, at 10:54 AM, Jordan Rose wrote: >> >> >> >>> On Oct 8, 2017, at 21:56, Slava Pestov via swift-evolution >>> wrote: >>> >>> >>> On Oct 7,

Re: [swift-evolution] Property Getter Return Statement

2017-10-10 Thread Slava Pestov via swift-evolution
> On Oct 9, 2017, at 10:54 AM, Jordan Rose wrote: > > > >> On Oct 8, 2017, at 21:56, Slava Pestov via swift-evolution >> wrote: >> >> >> >>> On Oct 7, 2017, at 7:07 AM, James Valaitis via swift-evolution >>>

Re: [swift-evolution] Property Getter Return Statement

2017-10-09 Thread Adrian Zubarev via swift-evolution
So you’re saying the core team _might_ consider a review if we’ve get a full proposal + implementation in Swift 5 timeframe? If yes, we only would need someone to implement my proposal. :) Am 9. Oktober 2017 um 19:54:50, Jordan Rose via swift-evolution (swift-evolution@swift.org) schrieb:

Re: [swift-evolution] Property Getter Return Statement

2017-10-09 Thread Jordan Rose via swift-evolution
> On Oct 8, 2017, at 21:56, Slava Pestov via swift-evolution > wrote: > > > >> On Oct 7, 2017, at 7:07 AM, James Valaitis via swift-evolution >> wrote: >> >> Is it widely agreed that it is necessary to require a return statement on a

Re: [swift-evolution] Property Getter Return Statement

2017-10-09 Thread Adrian Zubarev via swift-evolution
Even I would personally want this, this request didn’t made into Swift 3, nor in Swift 4 and is clearly out of scope for Swift 5. You can read my proposal here which includes all areas where this could be allowed: 

Re: [swift-evolution] Property Getter Return Statement

2017-10-08 Thread Charles Srstka via swift-evolution
> On Oct 7, 2017, at 12:22 PM, Tony Allevato via swift-evolution > wrote: > > I think the important thing to consider is, what advantage would such a > feature provide *other* than to reduce keystrokes? (I don't personally think > that optimizing for keys pressed by

Re: [swift-evolution] Property Getter Return Statement

2017-10-08 Thread Slava Pestov via swift-evolution
> On Oct 7, 2017, at 7:07 AM, James Valaitis via swift-evolution > wrote: > > Is it widely agreed that it is necessary to require a return statement on a > one line property getter? > > var session: AVCaptureSession { get { return layer.session } } > > Or could

Re: [swift-evolution] Property Getter Return Statement

2017-10-08 Thread David Hart via swift-evolution
> On 7 Oct 2017, at 19:22, Tony Allevato via swift-evolution > wrote: > > I think the important thing to consider is, what advantage would such a > feature provide *other* than to reduce keystrokes? (I don't personally think > that optimizing for keys pressed by

Re: [swift-evolution] Property Getter Return Statement

2017-10-07 Thread Tony Allevato via swift-evolution
I think the important thing to consider is, what advantage would such a feature provide *other* than to reduce keystrokes? (I don't personally think that optimizing for keys pressed by itself should be a goal.) In the case of closures, single expression closures without "return" improve

Re: [swift-evolution] Property Getter Return Statement

2017-10-07 Thread Nevin Brackett-Rozinsky via swift-evolution
On Sat, Oct 7, 2017 at 11:24 AM, Xiaodi Wu wrote: > This has been brought up on the list before. For instance: > > https://github.com/apple/swift-evolution/pull/608 > > Chris Lattner’s response at that time was: > > ‘Just MHO, but I consider this syntactic sugar, not a

Re: [swift-evolution] Property Getter Return Statement

2017-10-07 Thread Tony Allevato via swift-evolution
For what it's worth, you can drop the "get" part for read-only computed properties and write: var session: AVCaptureSession { return layer.session } On Sat, Oct 7, 2017 at 7:07 AM James Valaitis via swift-evolution < swift-evolution@swift.org> wrote: > Is it widely agreed that it is

Re: [swift-evolution] Property Getter Return Statement

2017-10-07 Thread Xiaodi Wu via swift-evolution
This has been brought up on the list before. For instance: https://github.com/apple/swift-evolution/pull/608 Chris Lattner’s response at that time was: ‘Just MHO, but I consider this syntactic sugar, not a fundamental feature that fits the goal of Swift 4 stage 2. ‘I’m also pretty opposed to

Re: [swift-evolution] Property Getter Return Statement

2017-10-07 Thread Nevin Brackett-Rozinsky via swift-evolution
+1 We don’t need “return” in single-line closures where the type is known, and I don’t see why it is required in single-line getters. Nevin On Sat, Oct 7, 2017 at 10:07 AM, James Valaitis via swift-evolution < swift-evolution@swift.org> wrote: > Is it widely agreed that it is necessary to

[swift-evolution] Property Getter Return Statement

2017-10-07 Thread James Valaitis via swift-evolution
Is it widely agreed that it is necessary to require a return statement on a one line property getter? var session: AVCaptureSession { get { return layer.session } } Or could we follow the convention for any other close and get rid of it? For me it seems redundant; the word `get` literally