Skip to content

Commit f9f0ea2

Browse files
committed
Work-in-progress second edition of generics.tex
This is not ready for review yet so I'm not updating the PDF on Swift.org.
1 parent 8f64bce commit f9f0ea2

32 files changed

+19289
-12263
lines changed

docs/Generics/Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,3 @@ generics.pdf:
33
bibtex generics
44
pdflatex generics
55
pdflatex generics
6-
7-
clean:
8-
rm *.aux *.bbl *.blg *.idx *.ilg *.ind *.log *.out *.pdf *.toc
9-
10-
.PHONY: clean

docs/Generics/chapters/basic-operation.tex

Lines changed: 531 additions & 0 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/building-generic-signatures.tex

Lines changed: 1334 additions & 0 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/class-inheritance.tex

Lines changed: 267 additions & 0 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/compilation-model.tex

Lines changed: 726 additions & 0 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/completion.tex

Lines changed: 1037 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
\documentclass[../generics]{subfiles}
2+
3+
\begin{document}
4+
5+
\chapter{Concrete Conformances}\label{concrete conformances}
6+
7+
\ifWIP
8+
TODO:
9+
\begin{itemize}
10+
\item Concrete conformance rule, property-like
11+
\item Virtual rule that introduces it
12+
\item Idea: it should eliminate the conformance rule but not the concrete type rule
13+
\item Doesn't actually appear in signature so should not impact minimization
14+
\item Conditional requirement inference, only in generic signatures and not protocols, because we can't merge connected components during completion. for a generic signature this actually has to import new components in the general case
15+
\end{itemize}
16+
\fi
17+
18+
\section{Type Witnesses}
19+
20+
\IndexTwoFlag{debug-requirement-machine}{concretize-nested-types}
21+
22+
\ifWIP
23+
TODO:
24+
\begin{itemize}
25+
\item Concrete type witness
26+
\item Abstract type witness
27+
\item Virtual rules
28+
\item Algorithm for building a ``relative'' concrete type symbol from substituting another symbol's pattern type
29+
\end{itemize}
30+
\fi
31+
32+
\section{Recursive Conformances}
33+
34+
\ifWIP
35+
TODO:
36+
\begin{itemize}
37+
\item Free conformances
38+
\item Can a protocol have a free conformance
39+
\item Can a conformance be made free by changing the protocol
40+
\item Conformance evaluation graph
41+
\item Heuristic to find same-type requirements from a conformance; just the parent type thing
42+
\item The problem with opaque archetypes
43+
\item Open question: can we encode a conformance more directly without evaluating it; \verb|G<G<G<T>>>| example
44+
\end{itemize}
45+
\fi
46+
47+
\IndexFlag{enable-requirement-machine-opaque-archetypes}
48+
49+
\section{Concrete Contraction}
50+
51+
\IndexFlag{disable-requirement-machine-concrete-contraction}
52+
\IndexTwoFlag{debug-requirement-machine}{concrete-contraction}
53+
54+
\ifWIP
55+
TODO:
56+
\begin{itemize}
57+
\item Doesn't actually appear in signature so should not impact minimization
58+
\item The problem: it might give you a smaller anchor
59+
\item Invariant violation without concrete contraction
60+
\item Concrete contraction substitutes superclass and concrete types
61+
\item Also GSB compatibility: T.A, T == C, C.A is a concrete typealias that's not an associated type. this doesn't add a rule
62+
\item Open question: can we do this in a more principled way
63+
\end{itemize}
64+
\fi
65+
66+
\section{Source Code Reference}
67+
68+
\end{document}

docs/Generics/chapters/conformance-paths.tex

Lines changed: 1389 additions & 0 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/conformances.tex

Lines changed: 681 additions & 0 deletions
Large diffs are not rendered by default.

docs/Generics/chapters/declarations.tex

Lines changed: 611 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
\documentclass[../generics]{subfiles}
2+
3+
\begin{document}
4+
5+
\chapter{Derived Requirements Summary}\label{derived summary}
6+
7+
\index{$\vdash$}
8+
\IndexStep{GenSig}
9+
\IndexStep{ReqSig}
10+
\IndexStep{AssocType}
11+
\IndexStep{Conf}
12+
\IndexStep{Equiv}
13+
\IndexStep{Same}
14+
\IndexStep{Member}
15+
\IndexStep{Concrete}
16+
17+
\begin{gather*}
18+
\vdash\ConfReq{T}{P}\tag{\textsc{GenSig}}\\
19+
\vdash\ConfReq{T}{C}\\
20+
\vdash\ConfReq{T}{AnyObject}\\
21+
\vdash\FormalReq{T == U}\\[\medskipamount]
22+
\ConfReq{T}{P}\vdash\texttt{T.A}\tag{\textsc{AssocType}}\\
23+
\ConfReq{T}{P}\vdash\texttt{T.[P]A}\\
24+
\ConfReq{T}{P}\vdash\FormalReq{T.[P]A == T.A}\\[\medskipamount]
25+
\vdash\ConfReq{Self.U}{P}\qquad\mbox{(in \texttt{P})}\tag{\textsc{ReqSig}}\\
26+
\vdash\ConfReq{Self.U}{C}\qquad\mbox{(in \texttt{P})}\\
27+
\vdash\ConfReq{Self.U}{AnyObject}\qquad\mbox{(in \texttt{P})}\\
28+
\vdash\FormalReq{Self.U == Self.V}\qquad\mbox{(in \texttt{P})}\\[\medskipamount]
29+
\ConfReq{T}{P},\,\ConfReq{Self.U}{Q}\vdash\ConfReq{T.U}{Q}\tag{\textsc{Conf}}\\
30+
\ConfReq{T}{P},\,\ConfReq{Self.U}{C}\vdash\ConfReq{T.U}{C}\\
31+
\ConfReq{T}{P},\,\ConfReq{Self.U}{AnyObject}\vdash\ConfReq{T.U}{AnyObject}\\
32+
\ConfReq{T}{P},\,\FormalReq{Self.U == Self.V}\vdash\FormalReq{T.U == T.V}\\[\medskipamount]
33+
\texttt{T}\vdash\FormalReq{T == T}\tag{\textsc{Equiv}}\\
34+
\FormalReq{T == U}\vdash\FormalReq{U == T}\\
35+
\FormalReq{T == U},\,\FormalReq{U == V}\vdash\FormalReq{T == V}\\[\medskipamount]
36+
\ConfReq{U}{P},\,\FormalReq{T == U}\vdash\ConfReq{T}{P}\tag{\textsc{Same}}\\
37+
\ConfReq{U}{C},\,\FormalReq{T == U}\vdash\ConfReq{T}{C}\\
38+
\ConfReq{U}{AnyObject},\,\FormalReq{T == U}\vdash\ConfReq{T}{AnyObject}\\[\medskipamount]
39+
\ConfReq{U}{P},\,\FormalReq{T == U}\vdash\FormalReq{T.A == U.A}\tag{\textsc{Member}}\\
40+
\ConfReq{U}{P},\,\FormalReq{T == U}\vdash\FormalReq{T.[P]A == U.[P]A}\\[\medskipamount]
41+
\FormalReq{T == U}\vdash\FormalReq{G<T> == G<U>}\qquad\mbox{(arbitrary type constructor \texttt{G<>})}\tag{\textsc{Concrete}}\\
42+
\FormalReq{G<T> == G<U>}\vdash\FormalReq{T == U}\qquad\mbox{(arbitrary type constructor \texttt{G<>})}
43+
\end{gather*}
44+
45+
\end{document}

0 commit comments

Comments
 (0)