# [pypy-svn] extradoc extradoc: go back to old definition and say something about side effects. kill section.

Thu Apr 14 16:56:22 CEST 2011

Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Changeset: r3507:d84ef2a455fe
Date: 2011-04-14 14:30 +0200

Log:	go back to old definition and say something about side effects. kill
section.

diff --git a/talk/icooolps2011/paper.tex b/talk/icooolps2011/paper.tex
--- a/talk/icooolps2011/paper.tex
+++ b/talk/icooolps2011/paper.tex
@@ -548,17 +548,15 @@
necessarily be folded away because the object can be mutated. Therefore, another
hint is needed.

-XXX not too happy with the definition
-
This hint can be used to mark functions as \emph{trace-elidable}. A function is
-termed trace-elidable if, during the execution of the program, the results of
-subsequent calls to the function with identical arguments may be be replaced
-with the result of the first call without changing the program's behaviour.
-From this
-definition follows that a call to an trace-elidable function with constant arguments
-in a trace can be replaced with the result of the call.\footnote{This property
-is less strict than that of a "pure" function, because it is only about actual
-calls during execution. All pure functions are trace-elidable though.}
+termed trace-elidable if, during the execution of the program,
+successive calls to the function with identical arguments always return the
+same result. In addition the function needs to have no side effects or
+idempotent side effects\footnote{This property
+is less strict than that of a pure function, because it is only about actual
+calls during execution. All pure functions are trace-elidable though.}.
+From this definition follows that a call to an trace-elidable function with
+constant arguments in a trace can be replaced with the result of the call.

As an example, take the following class:

@@ -647,23 +645,6 @@
incorrectly to mitigate this problem.

-\subsubsection{Observably trace-elidable Functions}
-
-\cfbolz{XXX do we kill this section?}
-
-Why can't we simply write an analysis to find out that the \texttt{x} fields of the
-\texttt{A} instances is immutable and deduce that \texttt{compute} is a trace-elidable function,
-since it only reads the \texttt{x} field and does not have side effects? This might
-be possible in this particular case, but in practice the functions that are
-annotated with the \texttt{elidable} decorator are usually more complex.
-The easiest example for this is that of a function that uses memoization to
-cache its results. If this function is analyzed, it looks like the function has
-side effects, because it changes the memoizing dictionary. However, because this side
-effect is not externally visible, the function is still trace-elidable. This is
-a property that is not easily detectable by analysis.
-
-
-
%___________________________________________________________________________

\section{Putting It All Together}