Re: [swift-evolution] Idea: Allow/require "let" in property setter name declarations

2016-05-08 Thread Geordie J via swift-evolution
Comments below > Am 06.05.2016 um 13:48 schrieb Haravikk via swift-evolution > : > > Actually a setter has more in common with a function, in which case the let > implicit, the difference is that a setters type is also implicit. In fact, > you don’t even need to

Re: [swift-evolution] Idea: Allow/require "let" in property setter name declarations

2016-05-06 Thread Chris Lattner via swift-evolution
On May 6, 2016, at 4:09 AM, Ian Partridge via swift-evolution wrote: > Currently, the syntax for explicitly naming property setters is: > > set(newPerimeter) { // declares newPerimeter parameter, "let" not allowed > sideLength = newPerimeter / 4.0 > } >

Re: [swift-evolution] Idea: Allow/require "let" in property setter name declarations

2016-05-06 Thread Haravikk via swift-evolution
Actually a setter has more in common with a function, in which case the let implicit, the difference is that a setters type is also implicit. In fact, you don’t even need to specify a name in a setter at all, as the default is newValue and you can just use that. I’m more curious whether we

[swift-evolution] Idea: Allow/require "let" in property setter name declarations

2016-05-06 Thread Ian Partridge via swift-evolution
Currently, the syntax for explicitly naming property setters is: class Square { var sideLength: Double = 0.0 var perimeter: Double { get { return sideLength * 4.0 } set(newPerimeter) { // declares newPerimeter parameter, "let" not allowed sideLength = newPerimeter /