This commit is contained in:
JKF
2026-06-03 16:25:51 +02:00
parent e7597f0f1d
commit 691d669642
+40 -3
View File
@@ -19,6 +19,11 @@ style: |
#### Julius Fischer #### Julius Fischer
###### 10. Juni 2026 ###### 10. Juni 2026
$$
\def\leftcirc{{\triangleleft\kern-0.1em\circ}}
\def\myor{{\;|\;}}
$$
--- ---
# What are Destinations? # What are Destinations?
@@ -64,12 +69,44 @@ map f (x:xs) dest = map f xs (push dest (f x))
--- ---
# DPS in functional languages # DPS in functional languages
- Just add pointers to mutable data? - Just add pointers to mutable data?
- $Int \mapsto Int \mapsto Int \mapsto \textcolor{red}{T}$ - $Int \mapsto Int \mapsto \textcolor{red}{T}$
- $\textcolor{red}{T *}\mapsto Int \mapsto Int \mapsto Int \mapsto Void$ - $\textcolor{red}{T *}\mapsto Int \mapsto Int \mapsto \dots$
- Multiple issues with this
- Memory safety
- Multilpe writes on shared memory
- Purity
--- ---
# Destination Calculus # Destination Calculus
- It's - Basic FP terms
$$
t, u := x \myor t' t \;|\; t ; t' \;|\; \dots
$$
- Case for all datatypes
$$
\begin{align}
\dots \myor
&case_m\;t\;of\;(v_1, v_2) \mapsto u \myor\\
&case_m\;t\;of\;(Inl\;v_1) \mapsto u \myor \dots
\end{align}
$$
- Additions for destination passing
$$
\begin{align}
\dots \myor
&
new_\ltimes \myor
from_\ltimes t \myor
to_\ltimes t \myor
upd_\ltimes \; t \; with \; x \mapsto t' \myor\\
&
t \blacktriangleleft t' \myor
t \leftcirc t' \myor
t \triangleleft () \myor
t \triangleleft Inl \myor
t \triangleleft (,) \myor \dots
\end{align}
$$
--- ---
# Referenes # Referenes