Skip to content

Commit 9484032

Browse files
committed
[docs] Add more terms to the Lexicon.
- canonical type - sugared type - generic environment - generic signature
1 parent f4e478e commit 9484032

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/Lexicon.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ source code, tests, and commit messages. See also the `LLVM lexicon`_.
7070
`mandatory passes <mandatory passes / mandatory optimizations>` have run.
7171
This can be used as input to IRGen to generate LLVM IR or object files.
7272

73+
canonical type
74+
A unique representation of a type, with any `sugar <sugared type>` removed.
75+
These can usually be directly compared to test whether two types are the
76+
same; the exception is when generics get involved. In this case you'll need
77+
a `generic environment`. Contrast with `sugared type`.
78+
7379
Clang importer
7480
The part of the compiler that reads C and Objective-C declarations and
7581
exposes them as Swift. Essentially contains a small instance of Clang
@@ -110,6 +116,20 @@ source code, tests, and commit messages. See also the `LLVM lexicon`_.
110116
Describes a type or function where making changes will break binary
111117
compatibility. See :doc:`LibraryEvolution.rst <LibraryEvolution>`.
112118

119+
generic environment
120+
Provides context for interpreting a type that may have generic parameters
121+
in it. Generic parameter types are normally just represented as "first
122+
generic parameter in the outermost context" (or similar), so it's up to the
123+
generic environment to note that that type must be a Collection. (Another
124+
way of looking at it is that the generic environment connects
125+
`interface types <interface type>` with
126+
`contextual types <contextual type>`).
127+
128+
generic signature
129+
A representation of all generic parameters and their requirements. Like
130+
types, generic signatures can be `canonicalized <canonical type>` to be
131+
compared directly.
132+
113133
iff
114134
"`if and only if`__". This term comes from mathematics.
115135

@@ -324,6 +344,13 @@ source code, tests, and commit messages. See also the `LLVM lexicon`_.
324344
known as "swiftCore"); sometimes it means everything in the stdlib/
325345
directory. Pronounced "stid-lib" or "ess-tee-dee-lib".
326346

347+
sugared type
348+
A type that may have been written in a more convenient way, using special
349+
language syntax or a typealias. (For example, ``Int?`` is the sugared form
350+
of ``Optional<Int>``.) Sugared types preserve information about the form
351+
and use of the type even though the behavior usually does not change
352+
(except for things like access control). Contrast with `canonical type`.
353+
327354
thunk
328355
In the Swift compiler, a synthesized function whose only purpose is to
329356
perform some kind of adjustment in order to call another function. For

0 commit comments

Comments
 (0)