Commit e3a46b27 authored by POTTIER Francois's avatar POTTIER Francois

Document all parameters.

parent f78ff383
......@@ -102,5 +102,8 @@
% Options.
\newcommand{\ancestors}{\texttt{ancestors}\xspace}
\newcommand{\concrete}{\texttt{concrete}\xspace}
\newcommand{\irregular}{\texttt{irregular}\xspace}
\newcommand{\name}{\texttt{name}\xspace}
\newcommand{\public}{\texttt{public}\xspace}
\newcommand{\variety}{\texttt{variety}\xspace}
......@@ -12,6 +12,7 @@
\input{listings-ocaml}
\lstset{language=ocaml}
\usepackage{moreverb}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage{xspace}
......@@ -1114,8 +1115,60 @@ form \oc|'self c as 'self|, where \oc|c| is a class.
\section{Reference}
% ------------------------------------------------------------------------------
\subsection{Parameters}
The following parameters can be passed as part of the
%
\oc|[@@deriving visitors { ... }]|
%
annotation, inside the curly braces.
% TEMPORARY vertical spacing
% TEMPORARY make it breakable
\begin{tabular}{@{}l@{\qquad}l@{\qquad}p{.6\textwidth}@{}}
\ancestors & (list of strings) &
A list of classes that the generated class should inherit.
The class \runtime{<variety>} is implicitly prepended to this list.
This is an optional parameter; its default value is the empty list.
\\
\concrete & (Boolean) &
If \oc|true|, the generated class is declared
concrete; otherwise, it is declared virtual.
This is an optional parameter; its default value is \oc|false|.
\\
\irregular & (Boolean) &
If \oc|true|, the regularity check (\sref{sec:regularity}) is disabled;
otherwise, it is enabled.
This is an optional parameter; its default value is \oc|false|.
\\
\name & (string) &
The name of the generated class.
This is an optional parameter; its default value is \oc|<variety>|.
\\
\public & (list of strings) &
This is an optional parameter.
If it is absent, then every method in the generated class is declared public.
If it is present, then every method in the generated class is declared
private, except those whose name appears in the list: those are declared public.
\\
\variety & (string) &
The variety of visitor that should be generated.
The supported varieties are
\iter (\sref{sec:intro:iter:def}),
\map (\sref{sec:intro:map}),
\mapendo (\sref{sec:intro:endo}),
\reduce (\sref{sec:intro:reduce}),
\fold (\sref{sec:intro:fold}),
\itertwo,
\maptwo,
\reducetwo,
\foldtwo (\sref{sec:intro:aritytwo}).
\\
\end{tabular}
% TEMPORARY
% document all parameters
% document the shape of the generated code (per-type)
\label{sec:regularity}
......@@ -1177,7 +1230,7 @@ document the OCaml object tricks that are used
one must make them parameters of the class (see OCaml manual)
here, every class is parameterized over ['self]
which allows all method types to be inferred (including virtual methods)
2. methods are monomorphic, but class can be polymorphic
2. methods are monomorphic, but a class can be polymorphic
3. can inherit classes that provide polymorphic methods
i.e., user can supply code both a priori (by providing ancestor classes)
and a posteriori (by defining child classes after the fact)
......@@ -1187,9 +1240,6 @@ document the OCaml object tricks that are used
référence:
document the regularity restriction \label{sec:regularity} and the option irregular
document all options
document the option concrete
document public
avoid shadowing the following names: VisitorsRuntime, Lazy, Pervasives
document which builtin types are supported by VisitorsRuntime
document which OCaml types can/cannot be traversed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment