|Anonymous | Login | Signup for a new account||2015-10-04 21:38 CEST|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005357||OCaml||OCaml general||public||2011-09-17 01:07||2013-08-31 12:49|
|Priority||normal||Severity||feature||Reproducibility||have not tried|
|Target Version||Fixed in Version||3.13.0+dev|
|Summary||0005357: Warning for redundant open M and let open M in|
|Description||GHC has a warning for never used imports; such imports are just redundant and cause unexpected name space contamination. The warning is useful to keep up your import list minimal as possible.|
OCaml's open has the same issue of the name space contamination, and unnecessary opens should be warned, too.
|Additional Information||And I have added a new warning for it.|
You can obtain the latest diff for OCaml 3.12.1 from my repo at https://bitbucket.org/camlspotter/mutated_ocaml [^] , redundant_open_warning branch.
With this patch, I have found nearly 150 redundant opens in OCaml source code!
A global hashtbl and side effects are used to minimize the amount of modifications for easy patching. If we are going to implement this feature in a future OCaml officially, we could make it cleaner.
|Tags||No tags attached.|
|Attached Files||ocaml-redundant-open.patch [^] (22,303 bytes) 2011-09-17 01:07 [Show Content]|
|That sounds like a pretty cool warning to have, and the patch seems to be moderately invasive. Jacques, any opinion on this?|
After reading it, it seems to do something useful in a straightforward way.
My only reservation is the "with_open" type constructor.
I would prefer something cleaner, like
type 'a info = Path.t * 'a * Path.t option
but this could actually make things more complicated...
This can easily be fixed afterwards.
Also we should probably remove all unneeded open's from the sources,
so there is no reason to disable the warning.
I'm for merging, but maybe better to ask on caml-devel first.
|Something I don't understand with the implementation is that "open statements" are identified simply with the opened path. So if we have two opens on the same module, and only one is actually used, the other will not be reported as being unused?|
Jacques: I was kicked out from caml-devel... :-(
Alain: Yeah, you are right. It should be better if we can detect all the unused open M's once and for all. I did not write that part just for simplicity.
I've added a similar warning to the unused_declarations branch:
|See 0005438. The new warning 33 detects unused open statements.|
|Thanks, the new warnings rock!|
|2011-09-17 01:07||furuse||New Issue|
|2011-09-17 01:07||furuse||File Added: ocaml-redundant-open.patch|
|2011-12-21 14:57||protz||Note Added: 0006456|
|2011-12-22 10:52||garrigue||Note Added: 0006490|
|2011-12-22 11:08||frisch||Note Added: 0006494|
|2011-12-22 12:14||furuse||Note Added: 0006499|
|2011-12-22 12:41||frisch||Note Added: 0006501|
|2012-01-17 23:27||lefessan||Relationship added||related to 0005438|
|2012-01-18 10:36||frisch||Note Added: 0006718|
|2012-01-18 10:36||frisch||Status||new => resolved|
|2012-01-18 10:36||frisch||Fixed in Version||=> 3.13.0+dev|
|2012-01-18 10:36||frisch||Resolution||open => fixed|
|2012-01-18 10:36||frisch||Assigned To||=> frisch|
|2012-05-03 04:31||furuse||Note Added: 0007403|
|2013-08-31 12:49||xleroy||Status||resolved => closed|
|Copyright © 2000 - 2011 MantisBT Group|