[GHC] #4959: Warning about variables with leading underscore that are used anyway
GHC
cvs-ghc at haskell.org
Mon Feb 14 19:09:30 CET 2011
#4959: Warning about variables with leading underscore that are used anyway
---------------------------------+------------------------------------------
Reporter: Lemming | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler (Parser)
Version: 7.0.1 | Keywords: warning unused underscore variable
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
I use -Wall all the time, which includes -fwarn-unused-binds and -fwarn-
unused-matches that warn about variable bindings that are not used. It
already spotted lots of mistakes for me. You can suppress the warning by
prepending an underscore '_' to a variable name. However, I have recently
seen code, where variable names with leading underscores are regularly
used, where other programmers might have chosen trailing underscores or
primes. I suspect that the programmer was not aware, that he disabled
warnings about unused bindings this way. Thus I like to have a warning
about underscored variables that are used in the sense of the definition
given for -fwarn-unused-binds in
http://www.haskell.org/ghc/docs/latest/html/users_guide/options-
sanity.html.
We still have to decide whether this warning should be part of -Wall or
-fwarn-unused-binds or whether there should be a separate option like
-fwarn-used-underscored-binds.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4959>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list