Skip to content

Allow 'public' classes to have 'internal' required initializers #14775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 26, 2018

Conversation

jrose-apple
Copy link
Contributor

They're already not subclassable publicly, so it's okay for the initializer to not be available to cross-module clients, just like if it were non-'required'. This allows constructing a class instance chosen at runtime within the module without having to expose the existence of the constructor to everybody.

rdar://problem/22845087

@jrose-apple
Copy link
Contributor Author

@jckarter, @rjmccall, do you think this needs to go through Evolution? Or is it a simple consequence of the open/public distinction that we're just finally getting to now?

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jckarter
Copy link
Contributor

This seems reasonable to me. More generally, required/designated/convenience could all ideally remain an implementation detail for classes in a non-open class hierarchy.

@jrose-apple
Copy link
Contributor Author

Ah, you can still write extensions of a non-open class, so I'm not sure I want to go there yet. And if the initializer is public then it can still be initialized dynamically across module boundaries.

They're already not subclassable publicly, so it's okay for the
initializer to not be available to cross-module clients, just like if
it were non-'required'. This allows constructing a class instance
chosen at runtime /within/ the module without having to expose the
existence of the constructor to everybody.

rdar://problem/22845087
@jrose-apple
Copy link
Contributor Author

@swift-ci Please smoke test

@jrose-apple jrose-apple merged commit d118e5c into swiftlang:master Feb 26, 2018
@jrose-apple jrose-apple deleted the tired-wired-required branch February 26, 2018 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants