Re: [swift-evolution] [Pitch] Unifying init parameters with properties

2016-04-18 Thread Vladimir.S via swift-evolution
-1 on #autoInit for properties declaration. Init should explicitly shows what parameters it will get and what will be assiged. I believe in case we want this feature, "self." prefix must be in init declaration in parameter list, with or without type(I prefer with type): init( self.foo: String,

Re: [swift-evolution] [Pitch] Unifying init parameters with properties

2016-04-18 Thread Haravikk via swift-evolution
I agree with the intent of this, but perhaps not the solution; sticking with the original example, simply being able to have an implied initialiser for classes, as we have for structs, would be enough, for example: class Foo { let foo:String let bar:String let baz:Int

Re: [swift-evolution] [Pitch] Unifying init parameters with properties

2016-04-18 Thread Vladimir.S via swift-evolution
-1 on this. After the parameter declaration we expect to see a type of that parameter. I don't think we should break Swift method declarations for this feature. I prefer to see information about parameter types in func/init declaration. I don't want to scroll up to the start of class declaration

Re: [swift-evolution] [Pitch] Unifying init parameters with properties

2016-04-17 Thread David Sweeris via swift-evolution
I think I like the idea... However IMHO this really feels like something that should be part of a macro system, not a "proper" language feature. - Dave Sweeris > On Apr 16, 2016, at 08:17, Jonathan Hull via swift-evolution > wrote: > > Since we know the types of the properties, how about we r

[swift-evolution] [Pitch] Unifying init parameters with properties

2016-04-17 Thread Yogev Sitton via swift-evolution
This is an interesting idea. Although I didn’t like this at first read - it will remove a lot of generic init methods from my code that all they do is just fill properties with values. > Since we know the types of the properties, how about we replace the type in > the signature with either an in

[swift-evolution] [Pitch] Unifying init parameters with properties

2016-04-16 Thread Jonathan Hull via swift-evolution
Since we know the types of the properties, how about we replace the type in the signature with either an indication that the property should be automatically set, or better yet, the property which should be set: class Foo { let foo : String let bar : String let barCount :

Re: [swift-evolution] [Pitch] Unifying init parameters with properties

2016-04-14 Thread Vladimir.S via swift-evolution
So I suggest to discuss some "middle" solution: not too complex, but that will improve our live. I believe this (in subject) proposal don't require a lot of changes in Swift, it seems more like sugar Compiler "just" can replace init (self.a: Int, self.b: String) { //... } to init (a: Int,

Re: [swift-evolution] [Pitch] Unifying init parameters with properties

2016-04-14 Thread Vladimir.S via swift-evolution
Don't think idea with super.bar etc in init is good, as we should explicitly call super.init() with needed parameters. So, I see this in such a way: init(self.foo: String, bar: String, baz: Int) super.init(bar: bar, baz: baz) ... } The only way we can specify values for super.init in our i

Re: [swift-evolution] [Pitch] Unifying init parameters with properties

2016-04-14 Thread Tino Heth via swift-evolution
There has been a long debate about something similar: [Proposal Draft] Flexible memberwise initialization Afair there has been a general agreement that the current boilerplate is ugly, but all suggested alternatives had flaws as well

Re: [swift-evolution] [Pitch] Unifying init parameters with properties

2016-04-14 Thread Ross O'Brien via swift-evolution
(re-added swift-evolution) I would think so. It's an abbreviation of a given init function, so you would call other self.init() or super.init() functions normally. Saves on complication. Alternatively, perhaps you could do this: init(self.foo: String, super.bar: String, super.baz: Int) as an a

[swift-evolution] [Pitch] Unifying init parameters with properties

2016-04-14 Thread Ross O'Brien via swift-evolution
This is a common pattern for initialisers at the moment: class Foo { let foo : String let bar : String let barCount : Int let baz : Int init(foo: String, bar: String, baz: Int) { self.foo = foo self.bar = bar self.baz = baz barCount = bar.characters.count } } This involves a lot of