Draft: Replace ERB with Pack Iteration #586
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request modernizes the Swinject codebase by removing code generation, adopting Swift's pack iteration, and refactoring several APIs for improved flexibility and maintainability. The changes simplify argument and type forwarding handling, eliminate repetitive boilerplate, and update the build process accordingly.
Migration to variadic generics and API simplification
Resolverprotocol andContainerimplementation, allowing any number of arguments to be passed without code generation. (Sources/Resolver.swift,Sources/Container.swift) [1] [2] [3]ServiceEntrytype forwarding API to use variadic generics, replacing multiple overloads with a single method that forwards any number of types. (Sources/ServiceEntry.TypeForwarding.swift)Removal of code generation and legacy files
script/gencode,Sources/Container.Arguments.erb, comments in source files) [1] [2] [3] [4]These changes make Swinject easier to maintain, more idiomatic to modern Swift, and remove the need for boilerplate code and build scripts.
Why is this a draft?
The compiler is not stable enough to properly support this feature, this PR's code causes a compile-time crash: