-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Define "abstraction pattern" and "reabstraction" in the Lexicon. #6493
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
Define "abstraction pattern" and "reabstraction" in the Lexicon. #6493
Conversation
@swift-ci Please smoke test |
Does this look reasonable, @jrose-apple or @rjmccall? Hard to judge what level of depth to get into defining these terms here. |
var value: (T) -> U // Bar.value has abstraction pattern <T, U> (T)->U | ||
} | ||
struct Bas { | ||
var value: (Int) -> String // Bas.value has abstraction pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't you forget the pattern here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, thanks @JaSpa!
746a88f
to
0be782d
Compare
@swift-ci Please smoke test |
@@ -23,6 +23,40 @@ source code, tests, and commit messages. See also the `LLVM lexicon`_. | |||
generic context. Sometimes known as a "rigid type variable" in formal | |||
CS literature. Directly stores its conforming protocols and nested | |||
archetypes, if any. | |||
|
|||
abstraction pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alphabetical, please. :-)
direct register-based calling convention. The compiler transparently | ||
introduces `reabstraction` conversions when a value is used with a | ||
different abstraction pattern. (This is where the infamous "reabstraction | ||
thunk helpers" you sometimes see in Swift backtraces come from.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I think this is the right level of detail but the wrong audience. Lexicon.rst is aimed at contributors to swiftc rather than users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you're referring to exactly. Compiler developers do also have to look at backtraces sometimes…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. I guess I was just going for a "dictionary" tone rather than an "instructing" tone; there isn't an implied "you" in any of the other terms. Not that important.
@@ -235,6 +269,10 @@ source code, tests, and commit messages. See also the `LLVM lexicon`_. | |||
IR generation. | |||
See `mandatory passes <mandatory passes / mandatory optimizations>`. | |||
|
|||
reabstraction | |||
An implicit representation change that occurs when a value is used with | |||
a different `abstraction pattern` from its current representation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, do we not consider things reabstractions unless they change a representation like this? (e.g. Optional to non-Optional in covariant overrides)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting question. We do use the "abstraction pattern" concept to govern method representations, so variance-related thunks could indeed be considered reabstractions.
@swift-ci Please smoke test |
0be782d
to
645a470
Compare
@jrose-apple Revised to fix alphabetical order and remove wanton second-person pronouns. |
@swift-ci Please smoke test |
No description provided.