comparison doc/manual.tex @ 2042:336070df8aec

Manual: Heuristic compilation warning
author Adam Chlipala <adam@chlipala.net>
date Sat, 26 Jul 2014 09:39:45 -0400
parents 3d10ae22abd6
children ced78ef1c82f
comparison
equal deleted inserted replaced
2041:ec7a1fa5e88f 2042:336070df8aec
375 \item \cd{URWEB\_NUM\_THREADS}: alternative to the \cd{-t} command-line argument (currently used only by FastCGI) 375 \item \cd{URWEB\_NUM\_THREADS}: alternative to the \cd{-t} command-line argument (currently used only by FastCGI)
376 \item \cd{URWEB\_STACK\_SIZE}: size of per-thread stacks, in bytes 376 \item \cd{URWEB\_STACK\_SIZE}: size of per-thread stacks, in bytes
377 \item \cd{URWEB\_PQ\_CON}: when using PostgreSQL, overrides the compiled-in connection string 377 \item \cd{URWEB\_PQ\_CON}: when using PostgreSQL, overrides the compiled-in connection string
378 \end{itemize} 378 \end{itemize}
379 379
380 \subsection{A Word of Warning on Heuristic Compilation}
381
382 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.
383
380 384
381 \section{Ur Syntax} 385 \section{Ur Syntax}
382 386
383 In this section, we describe the syntax of Ur, deferring to a later section discussion of most of the syntax specific to SQL and XML. The sole exceptions are the declaration forms for relations, cookies, and styles. 387 In this section, we describe the syntax of Ur, deferring to a later section discussion of most of the syntax specific to SQL and XML. The sole exceptions are the declaration forms for relations, cookies, and styles.
384 388
2553 \end{itemize} 2557 \end{itemize}
2554 2558
2555 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. 2559 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.
2556 2560
2557 2561
2558 \section{Compiler Phases} 2562 \section{\label{phases}Compiler Phases}
2559 2563
2560 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. 2564 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.
2561 2565
2562 In this section, we step through the main phases of compilation, noting what consequences each phase has for effective programming. 2566 In this section, we step through the main phases of compilation, noting what consequences each phase has for effective programming.
2563 2567
2564 \subsection{Parse} 2568 \subsection{Parse}
2565 2569