Skip to content

Warning for redundant open M and let open M in #5357

Description

@vicuna

Original bug ID: 5357
Reporter: furuse
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2013-08-31T10:49:10Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.12.1
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #5438
Monitored by: meyer @protz mehdi "Pascal Cuoq" dario @ygrek @glondu "Julien Signoles" @hcarty @Chris00 nogin @garrigue

Bug 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.

File attachments

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions