Skip to content

Commit

Permalink
move the tail_mod_cons documentation for "Langage Extensions" to "Tools"
Browse files Browse the repository at this point in the history
  • Loading branch information
gasche committed Nov 27, 2021
1 parent ef5b6bd commit 96c6a6a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions manual/src/allfiles.etex
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ and as a
\input{flambda.tex}
\input{afl-fuzz.tex}
\input{instrumented-runtime.tex}
\input{tail-mod-cons.tex}

\part{The OCaml library}
\label{p:library}
Expand Down
2 changes: 1 addition & 1 deletion manual/src/cmds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TRANSF = $(OCAMLRUN) $(TOOLS)/transf

FILES = comp.tex top.tex runtime.tex native.tex lexyacc.tex intf-c.tex \
ocamldep.tex profil.tex debugger.tex ocamldoc.tex \
warnings-help.tex flambda.tex \
warnings-help.tex flambda.tex tail-mod-cons.tex \
afl-fuzz.tex instrumented-runtime.tex unified-options.tex

etex-files: $(FILES)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
\chapter{The ``Tail Modulo Constructor'' program transformation} \label{c:tail_mod_cons}
%HEVEA\cutname{tail_mod_cons.html}

(Introduced in OCaml 4.14)

Note: this feature is considered experimental, and its interface may
Expand Down Expand Up @@ -147,7 +150,7 @@ tail-mod-cons are as follows:
using a convenient monadic notation.
\end{itemize}

\subsection{ss:disambiguation}{Disambiguation}
\section{sec:disambiguation}{Disambiguation}

It may happen that several arguments of a constructor are recursive
calls to a tail-modulo-cons function. The transformation can only turn
Expand Down Expand Up @@ -204,10 +207,10 @@ let[@tail_mod_cons] rec map_vars f exp =
Let ((f v, (map_vars[@tailcall]) f def), (map_vars[@tailcall]) f body)
\end{caml_example*}

\subsection{ss:out-of-tmc}{Danger: getting out of tail-mod-cons}
\section{sec:out-of-tmc}{Danger: getting out of tail-mod-cons}

Due to the nature of the tail-mod-cons transformation
(see Section~\ref{ss:details} for a presentation of transformation):
(see Section~\ref{sec:details} for a presentation of transformation):
\begin{itemize}
\item Calls from a tail-mod-cons function to another tail-mod-cons
function declared in the same recursive-binding group are
Expand Down Expand Up @@ -333,7 +336,7 @@ let[@tail_mod_cons] rec bind (f : 'a -> 'a tree) (t : 'a tree) : 'a tree =
Node (bind f left, (bind[@tailcall]) f right)
\end{caml_example*}

\subsection{ss:details}{Details on the transformation}
\section{sec:details}{Details on the transformation}

To use this advanced feature, it helps to be aware that the function transformation produces a specialized function in destination-passing-style.

Expand Down Expand Up @@ -427,7 +430,7 @@ and rec flatten_dps l dst i =
If "append_flatten" does not have a destination-passing-style version,
the call gets transformed to a non-tail call.

\subsection{ss:limitations}{Current limitations}
\section{sec:limitations}{Current limitations}

\paragraph{Purely syntactic criterion} Just like tail calls in
general, the notion of tail-modulo-constructor position is purely
Expand Down
3 changes: 1 addition & 2 deletions manual/src/refman/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ EXTENSION_FILES = letrecvalues.tex recursivemodules.tex locallyabstract.tex \
attributes.tex extensionnodes.etex extensiblevariants.tex \
generativefunctors.tex extensionsyntax.tex inlinerecords.tex \
doccomments.tex indexops.tex emptyvariants.tex alerts.tex \
generalizedopens.tex bindingops.tex extensionnodes.tex privatetypes.tex \
tail_mod_cons.tex
generalizedopens.tex bindingops.tex extensionnodes.tex privatetypes.tex

FILES = $(addprefix extensions/,$(EXTENSION_FILES)) \
refman.tex lex.tex names.tex values.tex const.tex types.tex \
Expand Down
4 changes: 0 additions & 4 deletions manual/src/refman/exten.etex
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,4 @@ that are implemented in OCaml, but not described in chapter \ref{c:refman}.
%HEVEA\cutname{bindingops.html}
\input{bindingops.tex}

\section{s:tail-mod-cons}{Tail Modulo Constructors}
%HEVEA\cutname{tailmodcons.html}
\input{tail_mod_cons.tex}

%HEVEA\cutend

0 comments on commit 96c6a6a

Please sign in to comment.