2015-04-19 22:32:01 +00:00
|
|
|
\emph{Referential transparency}, as in:
|
|
|
|
\slidep
|
|
|
|
\begin{itemizep}
|
|
|
|
\item everything (variables, data structures...) is \emph{immutable}
|
|
|
|
\item expressions never have side-effects (remember: mathematical functions)
|
|
|
|
\item same input $\mapsto$ same output... \emph{always}!
|
2015-04-20 18:55:41 +00:00
|
|
|
\item replace a function with it's (return) value? Yes. What happens in C or java if you do that? Remember \cppinline{void pop();}?
|
2015-04-19 22:32:01 +00:00
|
|
|
\end{itemizep}
|
|
|
|
\slidep
|
|
|
|
\vspace{\baselineskip}
|
|
|
|
possible benefits?
|
|
|
|
\begin{itemizep}
|
|
|
|
\item parallelism
|
|
|
|
\item equational reasoning and refactoring
|
|
|
|
\item less bugs!
|
|
|
|
\end{itemizep}
|
|
|
|
\slidep
|
|
|
|
\vspace{\baselineskip}
|
|
|
|
Question: call-by-value? call-by-reference? call-by-need?
|