Is it possible to pass ocaml flags specific to a file?
I'm thinking specifically of passing -rectypes for a .ml but not for the corresponding .mli
https://github.com/ocaml/dune/issues/61
so not atm
we could hack this with a library
and include
but yeah, it should be improved, with Dune 3.0 implementing this shouldn't take too long
I guess the use cases are very limited tho, that's why people didn't bother
on the other hand can you link modules with -rectypes with modules that don't use -rectypes?
maybe that could be done in the mli file with a [@@@ ]
pragma
rectypes can link with non rectypes but not viceversa
yeah so you force all users of the .ml to link with -rectypes anyways
Emilio Jesús Gallego Arias said:
we could hack this with a library
nope
because library has the same flags for mli and ml
but with rectypes if the ml has rectypes and the mli doesn't, it works and users don't need rectypes
I was thinking of a library just for the ml, then use a hack. Also we could add the rule just for that object.
the hack would be include
but indeed best is to have per_file flags
you mean use (action (run ocamlopt ...)) instead of the automatic rule?
Yup, but that's tricky too, you need to use then some special stuff for the cmo/cmx , as rules can't overlap
Dune 2.0 made hard to implement the flags per file, but 3.0 should be better so I guess it is just better to do so
Last updated: Jun 03 2023 at 15:31 UTC