-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Meta-issue on ambiguity warnings #6951
Description
Original bug ID: 6951
Reporter: @gasche
Status: acknowledged (set by @gasche on 2015-08-04T09:52:31Z)
Resolution: open
Priority: normal
Severity: feature
Version: undecided
Target version: undecided
Category: typing
Parent of: #5759 #5980 #6023 #7386
Monitored by: @Drup @diml @hcarty @dbuenzli
Bug description
This meta-issue is meant to reference, discuss and inform the past,
current and future feature suggestions related to handling of
ambiguity, in particular warnings when the compiler detects an
ambiguity situation.
The compiler may emit warning when it makes a choice on the meaning of
a particular identifier or symbol that may not be what the user
intents. Those warnings are intended to:
- make the code more readable by avoiding "surprising" disambiguation
choices - make the code robust to internal changes or dependency changes (a
new type annotation changing the ambiguity resolution of a field
name from scope-based to type-based; a new declaration in an opened
module shadowing a local identifier that was previously used, etc.)
Warnings are meant to flag situations that are likely sources of those
issues. The set of warnings should have good defaults that steer code
authors towards what is consensually considered good style, but also
be flexible enough to allow more or less demanding users to authorize
or rule out some slightly different styles.
Feel free to discuss problems with the current state of the ambiguity
detection, or propose improvements. If an idea gets a substantial
consensus, it should have an issue of the bugtracker on its own.
Additional information
The list of ideas currently floating across the bugtracker, caml-list
and github pull requests is the following:
[separate symbol warning]: #5980 discusses the problem that we
people may want to allow shadowing of symbols (infix and prefix
operators) but warn on shadowing of alphabetic identifiers. The
current shadowed-by-open warning (44) should be split between the
alphabetic name case and the symbol case.
[aliasing redefinition]: #5980 suggests that we should have no
warning when the shadowed and the shadowing identifier point to
the same thing
[M.!()]: #218 proposes a "M.!( ... )" syntax as a counterpart to
"let open! M in ..."
[incompatible types]: on caml-list Peter Urkedal suggests to only
warn when the type of the shadowed and shadowing identifiers are
compatible (one can be used in place of the other without breaking
type-correctness); if they incompatible, the user cannot
intentionally use one instead of the other.
https://sympa.inria.fr/sympa/arc/caml-list/2015-08/msg00027.html