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.

The following is horrible syntax but I wonder if there can be something that 
accomplishes these tasks - perhaps

@defaultInit  and

public @defaultInit

private @defaultInit

Best,

Daniel
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to