Skip to content

Commit 66a02b5

Browse files
committed
Fix typo: complexAlgorithm -> myAlgorithm
1 parent 3c8f1cc commit 66a02b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/Generics/generics.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5745,7 +5745,7 @@ \section{Primary Archetypes}\label{archetypesubst}
57455745
helper(s2)
57465746
}
57475747
\end{Verbatim}
5748-
The inner \texttt{helper()} function has a distinct generic signature, and therefore a distinct generic environment, from the outer \texttt{complexAlgorithm()} function. In particular, the outer function's generic parameter \texttt{S} maps to two \emph{different} archetypes inside the two declarations; say, $\archetype{S}_1$ and $\archetype{S}_2$. The type of the expression \texttt{s1} in \texttt{print(s1)} is $\archetype{S}_1$, and the type of \texttt{s2} in \texttt{helper(s2)} is $\archetype{S}_2$. The call to \texttt{helper()} supplies a substitution map which replaces the generic parameter \texttt{S} with the archetype $\archetype{S}_2$, and \texttt{T} with the contextual type \texttt{Array<}$\archetype{S}_2$\texttt{>}.
5748+
The inner \texttt{helper()} function has a distinct generic signature, and therefore a distinct generic environment, from the outer \texttt{myAlgorithm()} function. In particular, the outer function's generic parameter \texttt{S} maps to two \emph{different} archetypes inside the two declarations; say, $\archetype{S}_1$ and $\archetype{S}_2$. The type of the expression \texttt{s1} in \texttt{print(s1)} is $\archetype{S}_1$, and the type of \texttt{s2} in \texttt{helper(s2)} is $\archetype{S}_2$. The call to \texttt{helper()} supplies a substitution map which replaces the generic parameter \texttt{S} with the archetype $\archetype{S}_2$, and \texttt{T} with the contextual type \texttt{Array<}$\archetype{S}_2$\texttt{>}.
57495749

57505750
The only case where a generic environment is inherited by an inner declaration is if the inner declaration is not ``more generic'' in any way; it does not declare generic parameters, \emph{or} a \texttt{where} clause. As another example, anonymous closure expressions always inherit the generic environment of the outer declaration, because they cannot be generic except by referencing outer generic parameters.
57515751

0 commit comments

Comments
 (0)