Add inlinable notations to public API #26
Merged
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.
Something I've been aware of but not considered much is that Swift offers notations that control public module interface and may allow better optimizations when used from outside the module.
At a minimum, it seems to be good to mark public methods and computed properties as
@inlinable
. A declaration that is marked as@inlinable
requires thatinternal
declarations called within it be marked as@usableFromInline
.I haven't exhaustively covered each possible declaration but the primary public API should all be covered now.
https://github.com/apple/swift-evolution/blob/b8731d0d086c5cc0a08457a917c1d88ba3d202d2/proposals/0193-cross-module-inlining-and-specialization.md
https://forums.swift.org/t/when-should-both-inlinable-and-inline-always-be-used/37375