where $\ell$ ranges over an infinite set of labels $\Labels$,$\Undef$
where $\ell$ ranges over an infinite set of labels $\Labels$ and$\Undef$
is a special singleton type whose only value is the constant
$\undefcst$ which is a constant not in $\Any$. The type
$\record{\ell_1=t_1\ldots\ell_n=t_n}{t}$ is a \emph{quasi-constant
...
...
@@ -34,12 +34,12 @@ following syntactic sugar and that form the \emph{record types} of our language\
\item$\crecord{\ell_1=t_1, \ldots, \ell_n=t_n}$ for $\record{\ell_1=t_1\ldots\ell_n=t_n}{\Undef}$ (closed records).
\item$\orecord{\ell_1=t_1, \ldots, \ell_n=t_n}$ for $\record{\ell_1=t_1\ldots\ell_n=t_n}{\Any\vee\Undef}$ (open records).
\end{itemize}
plus the notation $\mathtt{\ell\eqq t}$ to denote optional fields,
plus the notation $\mathtt{\ell\eqq} t$ to denote optional fields,
which corresponds to using in the quasi-constant function notation the
field $\ell= t \vee\Undef$.
For what concern expressions, we adapt CDuce records to our analysis. In particular records are built starting from the empty record expressions\erecord{} and by adding, updating, or removing fields:\vspace{-1mm}
For what concerns expressions, we adapt CDuce records to our analysis. In particular records are built starting from the empty record expression \erecord{} and by adding, updating, or removing fields:\vspace{-1mm}
\[
\begin{array}{lrcl}
\textbf{Expr}& e & ::=&\erecord{}\alt\recupd e \ell e \alt\recdel e \ell\alt e.\ell
...
...
@@ -62,7 +62,7 @@ To define record type subtyping and record expression type inference we need the
\proj{\ell'} u \geq\proj{\ell'} t &\text{ otherwise}
\end{array}\right\}\right\}
\end{eqnarray}
Then two record types $t_1$ and $t_2$ are in subtyping relation, $t_1\leq t_2$, if and only if $\forall\ell\in\Labels. \proj\ell{t_1}\leq\proj\ell{t_2}$. In particular $\orecord{\!\!}$ is the largest record type.
Then two record types $t_1$ and $t_2$ are in subtyping relation, $t_1\leq t_2$, if and only if forall $\ell\in\Labels$ we have $\proj\ell{t_1}\leq\proj\ell{t_2}$. In particular $\orecord{\!\!}$ is the largest record type.
Expressions are then typed by the following rules (already in algorithmic form).
\begin{mathpar}
...
...
@@ -86,7 +86,7 @@ Expressions are then typed by the following rules (already in algorithmic form).
{\Gamma\vdash e.\ell:\proj\ell{t}}
{e.\ell\not\in\dom\Gamma}\vspace{-2mm}
\end{mathpar}
To extend occurrence typing to records we add paths the following values to paths: $\varpi\in\{\ldots,a_\ell,u_\ell^1,u_\ell^2,r_\ell\}^*$, with
To extend occurrence typing to records we add the following values to paths: $\varpi\in\{\ldots,a_\ell,u_\ell^1,u_\ell^2,r_\ell\}^*$, with
\(e.\ell\downarrow a_\ell.\varpi=\occ{e}\varpi\),
\(\recdel e \ell\downarrow r_\ell.\varpi=\occ{e}\varpi\), and