[swift-evolution] [Pitch] Unifying init parameters with properties
narrativium at gmail.com
Thu Apr 14 10:40:49 CDT 2016
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
Alternatively, perhaps you could do this:
init(self.foo: String, super.bar: String, super.baz: Int)
as an abbreviation of
init(foo: String, bar: String, baz: Int)
self.foo = foo
super.init(bar: bar, baz: baz)
I think this would probably require allowing parameters to stay
re-orderable, though (in case super's init is "init(baz: Int, bar: String)"
On Thu, Apr 14, 2016 at 4:29 PM, Vladimir.S wrote:
> +1. This will make our life easier, it is clear and explicit about the
> I assume that there must be a constrain : you can use in init(...) only
> props introduced in the same class, not in parent class.
> On 14.04.2016 17:32, Ross O'Brien via swift-evolution wrote:
>> init(self.foo: String, self.bar: String, self.baz: Int)
>> barCount = bar.characters.count
>> Less boilerplate, more focus on the properties which need to be generated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution