A Cmdliner.Arg module defines an (&)
operator that, AFAIU, does exactly the same as (@@)
(even though &
has lower precedence).
Now, when you try to actually use it, it results in a warning:
Warning number 44
/home/hoichi/dev/bsdoc/src/Cli.re 107:7-111:8
105 ┆ let out_dir = {
106 ┆ let doc = "Output directory of the generated documentation";
107 ┆ Arg.(
108 ┆ value
109 ┆ & opt(file, "./docs")
110 ┆ & info(["o", "output-dir"], ~docv="DIR", ~doc)
111 ┆ );
112 ┆ };
113 ┆
this open statement shadows the value identifier & (which is later used)
Question 1 (a practical one): What’s the best way to fix it? Simply replacing &
s with @@
s seem to work: simply opening the module doesn’t trigger the warning, using the operator does. But there should be a reason why the cmdliner author(s) defined &
(it sure does look better).
Questions 2 and 3 (just wondering). Is the warning happening on every ambiguous shadowing? “later used” sounds a bit misleading for the Foo.()
usage, when the shadowing is very local. And: how come nobody complained about this to cmdliner before? Maybe bsdoc does something wrong?