[swift-evolution] [Proposal Draft] Flexible memberwise initialization
2th at gmx.de
Sat Dec 26 05:04:22 CST 2015
> Sorry if this has been discussed and I missed it, but Scala and Kotlin both support a compact function-like class declaration syntax for simple "case classes".
Just took some time to read more deeply and would have added a reference to Kotlin on my own — I think their approach of solving the problem from the other direction (turning parameters into members instead of inferring parameters for properties) feels quite natural and avoids many problems; but unless the decision to remove var parameters is revised, I think it's unfortunate to introduce them in another context.
We shouldn't forget that initializers in Swift already are a quite huge and complicated topic (required, convenience, when to call super…) with big potential to confuse newcomers; so I'd recommend to be careful introducing new keywords and concepts that aren't useful in other places and rather stick with a less complete solution that is lightweight and elegant:
It could be considered to simply don't address parts of the problem in the language at all, but encourage better tools to manage the boilerplate.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution