[wg-camlp4] Keeping attributes in .cmi files?
alain.frisch at lexifi.com
Wed Sep 18 10:34:01 BST 2013
Attributes are currently kept in .cmt and .cmti files, which are dumps
of the Typedtree counterparts of .ml and .mli files. This allows
external tools to access those attributes together with the output of
the type-checker. But this does not easily allow the compiler itself
(which doesn't parse the .cmti file) to see attributes from external units.
If we keep attributes also in the internal structure of the
type-checker, which is dumped in the .cmi file, we can make the compiler
aware, for instance, of attributes put on value declarations.
As an example, see the following discussion about having the compiler
report a warning when a value marked as deprecated is being used:
Attributes give a natural way to mark values as deprecated, and as I
suggest in the discussion, the simplest way to use this information is
to keep it in the Types.value_description record (and thus in .cmi files).
If we start having the compiler understand some specific attributes, it
makes sense, in my opinion, to keep them even in .cmi files (at least
for attributes on "declarations", not necessarily on type expressions).
Do you agree? Would anyone object to the patch I proposed on the
More information about the wg-camlp4