Commit e932ff99 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Document the problem caused by module aliases.

parent 2a307885
Pipeline #161642 passed with stages
in 26 seconds
......@@ -2,6 +2,9 @@
## 2020/07/XX
* Document the problem caused by placing a module alias declaration
in an `.mly` file. (See *Questions and Answers* in the manual.)
* Turn off a costly internal well-formedness assertion.
This allows a 30% speedup in the construction of large automata
and in the conflict explanation process. (Reported by Joe.)
......@@ -4563,6 +4563,28 @@ please use and adapt the rules found in the file \distrib{src/stage2/dune}.
% \dune will automatically add this line for us
% when a project is first compiled.
\question{My \mly file begins with a module alias declaration \texttt{module F
= Foo}. Because of this, the \mli file generated by Menhir contains
references to \texttt{F} instead of \texttt{Foo}. This does not make sense!}
Beginning with \menhir 20200525, \menhir prefers to use the types inferred by
the \ocaml compiler over the types provided by the user in \dtype
declarations. (This may sound strange, but these types can differ in some
situations that involve polymorphic variants. Using the inferred type is
required for type soundness.)
In the presence of a~module alias declaration such as \texttt{module F =
Foo}, OCaml can infer types that begin with \texttt{F.} instead of
\texttt{Foo.}, and Menhir currently does not detect that \texttt{F} is a local
The suggested fix is to avoid placing module alias declarations in \mly files.
% fp: If people insist on using module aliases, the simplest way of supporting
% them would be to generate a module alias definition both in the .ml file
% and in the .mli file. This could be done by adding a new %module_alias
% declaration to Menhir.
\question{\menhir reports \emph{more} shift/reduce conflicts than
\ocamlyacc! How come?} \ocamlyacc sometimes merges two states
of the automaton that \menhir considers distinct. This happens
Supports Markdown
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