Skip to content

Commit f2249e9

Browse files
committed
[NFC] Define “access path” in the lexicon
1 parent 6da428a commit f2249e9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/Lexicon.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,28 @@ introduces [reabstraction](#reabstraction) conversions when a value is used with
4545
different abstraction pattern. (This is where the infamous "reabstraction
4646
thunk helpers" sometimes seen in Swift backtraces come from.)
4747

48+
## access path
49+
50+
Broadly, an "access path" is a list of "accesses" which must be chained together
51+
to compute some output from an input. For instance, the generics system has a
52+
type called a `ConformanceAccessPath` which explains how to, for example,
53+
walk from `T: Collection` to `T: Sequence` to `T.Iterator: IteratorProtocol`.
54+
There are several different kinds of "access path" in different parts of the compiler,
55+
but they all follow this basic theme.
56+
57+
In the specific context of imports, an "access path" is the `Bar` portion of a scoped
58+
import like `import class Foo.Bar`. Theoretically, it could have several identifiers
59+
to designate a nested type, although the compiler doesn't currently support this. It can
60+
also be empty, matching all top-level declarations in the module.
61+
62+
Note, however, that there has historically been some confusion about the meaning of
63+
"access path" with regards to imports. You might see some code use "access path"
64+
to include the `Foo` part or even to describe a chain of submodule names where a
65+
declaration is not valid at all. (Strictly, the chain of module names is a "module path"
66+
and the combination of module path + access path is an "import path".)
67+
68+
See `ImportPath` and the types nested inside it for more on this.
69+
4870
## archetype
4971

5072
A placeholder for a generic parameter or an associated type within a

0 commit comments

Comments
 (0)