Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-06-01 Thread Andrew Bennett via swift-evolution
I imagine you can use a combination of: *Deferred for Future Discussion*: https://github.com/apple/swift-evolution#deferred-for-future-discussion *Accepted proposals which do not have a complete implementation:*

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-06-01 Thread Adrian Zubarev via swift-evolution
Feel free to convince the core team to add such a list. ;) --  Adrian Zubarev Sent with Airmail Am 1. Juni 2016 um 19:17:25, Vladimir.S (sva...@gmail.com) schrieb: Do we have any 'feature' to not just throw away of proposals(and then scan mail list and remember), but put them in queue of

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-06-01 Thread Vladimir.S via swift-evolution
Do we have any 'feature' to not just throw away of proposals(and then scan mail list and remember), but put them in queue of proposals that should be reviewed after Swift 3 is released? Probably some list of such proposals on site, don't know. So I believe any proposal that would be raised

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-06-01 Thread Adrian Zubarev via swift-evolution
Given that Swift 3 is winding down, we are in a mode of declining PRs for proposals that don’t align with its goals. Please bring this back up for discussion this fall, thanks for understanding. Closed by Chris. Sad but we’ll have to wait a little longer for this change. --  Adrian Zubarev

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Thorsten Seitz via swift-evolution
+1 `return` in guards should stay, because there one has to use either `return`, `continue` or `break`. It would be ugly and inconsistent if one of these could be left out. -Thorsten > Am 31.05.2016 um 20:16 schrieb Vladimir.S via swift-evolution > : > > I really

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Adrian Zubarev via swift-evolution
I added the example I posted in my last reply and submitted a pull request.  --  Adrian Zubarev Sent with Airmail ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Vladimir.S via swift-evolution
On 31.05.2016 22:42, Leonardo Pessoa via swift-evolution wrote: I'd actually like to see a change in guard so that I don't need those braces. I'd like something more readable like | guard cond1 or return nil | guard cond2 or throw MyError.IllegalValue | guard cond3 or do { ... } I

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Adrian Zubarev via swift-evolution
I apologize for the tons of typos I make. :/ --  Adrian Zubarev Sent with Airmail Am 31. Mai 2016 um 21:55:53, Adrian Zubarev (adrian.zuba...@devandartist.com) schrieb: I'd actually like to see a change in guard so that I don't need those  braces. I'd like something more readable like  |

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Leonardo Pessoa via swift-evolution
I'd actually like to see a change in guard so that I don't need those braces. I'd like something more readable like | guard cond1 or return nil | guard cond2 or throw MyError.IllegalValue | guard cond3 or do { ... } It may add more cases for the compiler to handle but in all cases I used

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Matthew Johnson via swift-evolution
> On May 31, 2016, at 2:36 PM, Adrian Zubarev via swift-evolution > wrote: > >> Exactly. You are allowed to omit `return` if the entire body only consists >> of `return some().expression` > > Thats where the useless example comes in (but we don’t need this

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Adrian Zubarev via swift-evolution
Exactly.  You are allowed to omit `return` if the entire body only consists of `return some().expression` Thats where the useless example comes in (but we don’t need this behavior at all): func foo(boolean: Bool) {     guard boolean else {}     print("true“) } I made some changes to the

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread L Mihalkovic via swift-evolution
> On May 31, 2016, at 8:45 PM, Adrian Zubarev via swift-evolution > wrote: > > I feel like return is very important part of guard statement. I understand > the requirement for consistency with properties/closures/functions, but I’ll > prefer to have some

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Matthew Johnson via swift-evolution
> On May 31, 2016, at 2:13 PM, Adrian Zubarev via swift-evolution > wrote: > >> Please remove the section on guard as any of the preceding will never have >> single expression top level code blocks if they contain a guard clause. > > I didn’t get this at first but

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Adrian Zubarev via swift-evolution
Please remove the section on guard as any of the preceding will never have single expression top level code blocks if they contain a guard clause. I didn’t get this at first but now I see your point, it’s because the whole returning scope will need `return` at the very end so `guard` should

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Matthew Johnson via swift-evolution
> On May 31, 2016, at 1:59 PM, Adrian Zubarev via swift-evolution > wrote: > >> +1. This is example *is not* a single expression code block. There are 3 >> expressions (the condition, the return value in the else block, and the >> primary return value). > > The

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Matthew Johnson via swift-evolution
> On May 31, 2016, at 12:35 PM, Adrian Zubarev via swift-evolution > wrote: > > Here is the draft proposal: > https://github.com/DevAndArtist/swift-evolution/blob/single_expression_optional_return/proposals/-single-expression-optional-return.md > >

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Adrian Zubarev via swift-evolution
+1. This is example *is not* a single expression code block. There are 3 expressions (the condition, the return value in the else block, and the primary return value).  The `else` block is a returning single expression block. I can’t show the `guard` example without any returning scope. You

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Matthew Johnson via swift-evolution
> On May 31, 2016, at 1:16 PM, Vladimir.S via swift-evolution > wrote: > > I really like the proposal in case of properties and functions, but I really > don't want to have > guard boolean else { "false” } +1. This is example *is not* a single expression code

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Adrian Zubarev via swift-evolution
I really like the proposal in case of properties and functions, but I  really don't want to have  guard boolean else { "false" }  I feel like `return` is very important part of `guard` statement.  I understand the requirement for consistency with  properties/closures/functions, but I'll prefer to

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Adrian Zubarev via swift-evolution
I feel like return is very important part of guard statement. I understand the requirement for consistency with properties/closures/functions, but I’ll prefer to have some inconsistency in language in this case and require return for guard. And in case I’ll have to choose all-or-nothig, I’ll

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Vladimir.S via swift-evolution
I really like the proposal in case of properties and functions, but I really don't want to have guard boolean else { "false" } I feel like `return` is very important part of `guard` statement. I understand the requirement for consistency with properties/closures/functions, but I'll prefer to

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread David Sweeris via swift-evolution
I'd interpret that as being able to write: var x: Int8 { 20 } as opposed to: var x: Int8 { Int8(20) } - Dave Sweeris > On May 31, 2016, at 12:47, David Rönnqvist via swift-evolution > wrote: > > Under "Proposed solution" you say (emphasis mine): > > "Make return

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread David Rönnqvist via swift-evolution
Under "Proposed solution" you say (emphasis mine): "Make return optional and infer return type for single-expressions everywhere in the language:" However the return type isn't inferred for computed properties or functions, and I don't see type inference being discussed in the proposal (other

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Adrian Zubarev via swift-evolution
Here is the draft proposal: https://github.com/DevAndArtist/swift-evolution/blob/single_expression_optional_return/proposals/-single-expression-optional-return.md Did I covered everything case? If you find some mistakes feel free to provide feedback so I can fix the proposal before I submit

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Leonardo Pessoa via swift-evolution
+1 L On 31 May 2016 at 12:47, Matthew Johnson via swift-evolution wrote: > >> On May 28, 2016, at 3:09 AM, David Hart via swift-evolution >> wrote: >> >> It isn’t a special case because all other single-statement closures in the >>

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread Matthew Johnson via swift-evolution
> On May 28, 2016, at 3:09 AM, David Hart via swift-evolution > wrote: > > It isn’t a special case because all other single-statement closures in the > language work that way. It’s actually inconsistent now. Computed properties aren’t closures so it’s not

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-31 Thread David Hart via swift-evolution
It isn’t a special case because all other single-statement closures in the language work that way. It’s actually inconsistent now. > On 28 May 2016, at 09:03, Brian Christensen via swift-evolution > wrote: > > On May 27, 2016, at 13:57, Adrian Zubarev via

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-28 Thread Haravikk via swift-evolution
I’m a +1 to this, this is something that keeps catching me out as I’m so used to omitting return in other closures, and that’s essentially all a computer property is anyway so it makes sense for the behaviour to be consistent. > On 27 May 2016, at 18:57, Adrian Zubarev via swift-evolution >

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-28 Thread Adrian Zubarev via swift-evolution
I'll write a small proposal tomorrow for that behavior (not only for computed properties of course)! Today I'm too busy. Thank you for your positive feedback. -- Adrian Zubarev Sent with Airmail Am 28. Mai 2016 um 10:11:26, David Hart (da...@hartbit.com(mailto:da...@hartbit.com))

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-28 Thread David Hart via swift-evolution
It isn’t a special case because all other single-statement closures in the language work that way. It’s actually inconsistent now. > On 28 May 2016, at 09:03, Brian Christensen via swift-evolution > wrote: > > On May 27, 2016, at 13:57, Adrian Zubarev via

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-28 Thread Patrick Smith via swift-evolution
+1. This has always tripped me up, I guess I felt there was a good reason for requiring you to add a `return`, but not sure what it would be. > On 28 May 2016, at 3:57 AM, Adrian Zubarev via swift-evolution > wrote: > > The idea is simple: > > Can we make return

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-28 Thread Brian Christensen via swift-evolution
On May 27, 2016, at 13:57, Adrian Zubarev via swift-evolution wrote: > The idea is simple: > > • Can we make return keyword optional in cases like this? > • Shouldn’t this behave like @autoclosure or @noescape? > type A { > var characters: [Character]

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-27 Thread Dennis Weissmann via swift-evolution
+ 1 from me as well for the already stated reasons. - Dennis > On May 28, 2016, at 2:15 AM, Matthew Johnson via swift-evolution > wrote: > > > > Sent from my iPad > > On May 27, 2016, at 6:15 PM, Brent Royal-Gordon via swift-evolution >

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-27 Thread Matthew Johnson via swift-evolution
Sent from my iPad On May 27, 2016, at 6:15 PM, Brent Royal-Gordon via swift-evolution wrote: >> The idea is simple: >> >>• Can we make return keyword optional in cases like this? >>• Shouldn’t this behave like @autoclosure or @noescape? > > This actually

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-27 Thread Rod Brown via swift-evolution
+1. Completely agree with Brent's views here. On 28 May 2016, at 9:15 AM, Brent Royal-Gordon via swift-evolution wrote: >> The idea is simple: >> >>• Can we make return keyword optional in cases like this? >>• Shouldn’t this behave like @autoclosure or

Re: [swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-27 Thread Brent Royal-Gordon via swift-evolution
> The idea is simple: > > • Can we make return keyword optional in cases like this? > • Shouldn’t this behave like @autoclosure or @noescape? This actually doesn't have anything to do with @autoclosure or @noescape. Any one-expression closure can omit the `return` statement and have

[swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

2016-05-27 Thread Adrian Zubarev via swift-evolution
The idea is simple: Can we make return keyword optional in cases like this? Shouldn’t this behave like @autoclosure or @noescape? type A { var characters: [Character] = … var string: String { String(self.characters) } var count: Int { 42 } } Is this worth a proposal or Swifty enough,