
I don't have too strong an opinion here, but I want to note that sometimes the use of a variable with a leading underscore is intentional. In particular, I have found this necessary when I use CPP to optionally disable a certain chunk. I don't want warnings to appear when I disable
#4959: Warning about variables with leading underscore that are used anyway -------------------------------------+------------------------------------- Reporter: Lemming | Owner: Type: feature request | Status: new Priority: low | Milestone: 7.10.1 Component: Compiler | Version: 7.0.1 (Parser) | Keywords: warning unused Resolution: | underscore variable Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by Lemming): Replying to [comment:6 goldfire]: the chunk (eliminating the one use of a variable, to which I prepend a `_`) or when I enable the chunk (now using a variable with a leading underscore). Could you move the conditionally used variable into the `#ifdef` block?
So, I have a slight preference for "no change" here, but it really is a slight preference -- I do see and understand the original poster's point.
It should be possible to disable the used-underscore-warning. If the CPP problem arises often and is hard to workaround, then it would be still great to enable the used-underscore-warning on demand. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/4959#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler