[swift-evolution] [Probe] The automatically generated init for structs
clattner at apple.com
Fri Jul 1 15:24:08 CDT 2016
> On Jul 1, 2016, at 4:09 AM, Daniel Steinberg via swift-evolution <swift-evolution at swift.org> wrote:
> My apologies if this was resolved before.
> At one point there was a suggestion for the access level for the auto-generated init for structs. The issue was that the access level is internal by default. If you want to make this init public you have to implement the init yourself - there is no syntax for marking the default init as public.
> Also, as in many other languages, if you implement your own init the default init is not generated. There are times when you want this to be generated anyway so that other inits might call through it. Perhaps to set default values without having to reimplement this init.
> Finally, in this last case you might want the default init generated but not exposed to the module or publicly - you may want to mark it as fileprivate but expose another init that uses it.
This topic has definitely come up, culiminating in this proposal:
I expect this to come up again after Swift 3 is done,
More information about the swift-evolution