[swift-evolution] Proposal: label-only constructors
drew at sealedabstract.com
Sun Dec 13 07:21:18 CST 2015
> On Dec 13, 2015, at 7:13 AM, ilya <ilya.nikokoshev at gmail.com> wrote:
> You can easily call a private parametrized init from a class function though.
Sure, but we're just shuffling the deck. We've gone from a bad public API to a bad private API.
Actually, it's worse, because we now have BOTH a bad private API AND a bad public API. There is a reason that NSData.dataWithData(...) is a Swift compile error.
The (ab)use of class functions as constructors is a holdover from ObjC times. If you want to make an instance in Swift, you should type ClassName( and see what autocomplete suggests; you should not have to read through the documentation of class functions to see if they are secretly constructors that have been filed at the wrong shelf in the library.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution