From 11e4fd74efb535f8681b5be83c914bb2ca1bcc7f Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 26 Jul 2014 09:39:45 -0400 Subject: Manual: Heuristic compilation warning --- doc/manual.tex | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'doc/manual.tex') diff --git a/doc/manual.tex b/doc/manual.tex index 65f6f95d..2218d2c5 100644 --- a/doc/manual.tex +++ b/doc/manual.tex @@ -377,6 +377,10 @@ Compiled applications consult a few environment variables to modify their behavi \item \cd{URWEB\_PQ\_CON}: when using PostgreSQL, overrides the compiled-in connection string \end{itemize} +\subsection{A Word of Warning on Heuristic Compilation} + +For server-side code, Ur/Web follows an unusual compilation model, where not all type-correct programs can be compiled successfully, especially when using functions as data not known until runtime. See Section \ref{phases} for more detail. + \section{Ur Syntax} @@ -2555,9 +2559,9 @@ Now \texttt{foo} is available as a normal function. If called in server-side co When no \texttt{jsFunc} directive is present, the function is assumed to map to a JavaScript function of the same name, if used in a client-side context. -\section{Compiler Phases} +\section{\label{phases}Compiler Phases} -The Ur/Web compiler is unconventional in that it relies on a kind of \emph{heuristic compilation}. Not all valid programs will compile successfully. Informally, programs fail to compile when they are ``too higher order.'' Compiler phases do their best to eliminate different kinds of higher order-ness, but some programs just won't compile. This is a trade-off for producing very efficient executables. Compiled Ur/Web programs use native C representations and require no garbage collection. +The Ur/Web compiler is unconventional in that it relies on a kind of \emph{heuristic compilation}. Not all valid programs will compile successfully. Informally, programs fail to compile when they are ``too higher order.'' Compiler phases do their best to eliminate different kinds of higher order-ness, but some programs just won't compile. This is a trade-off for producing very efficient executables. Compiled Ur/Web programs use native C representations and require no garbage collection. Also, this warning only applies to server-side code, as client-side code runs in a normal JavaScript environment with garbage collection. In this section, we step through the main phases of compilation, noting what consequences each phase has for effective programming. -- cgit v1.2.3