RE: nhc98 rejects legal rebinding
"Simon Marlow" <[email protected]> Tue, 27 May 2003 11:18:39 +0100
| Newsgroups | gmane.comp.lang.haskell.nhc.bugs |
|---|---|
| Message-ID | <9584A4A864BD8548932F2F88EB30D1C60D10293F@TVP-MSG-01.europe.corp.microsoft.com> |
Malcolm writes: > However, I do not propose to fix this bug in nhc98. The example > you give is extremely likely to be a programmer's mistake, so in > my opinion the error message from the compiler is more useful than > the strange runtime behaviour that might otherwise occur. When the > rebinding is deliberate, it is easy for the author to find a different > way of coding the intended semantics. While the behaviour might arguably be wrong, I believe it's more important to stick to the letter of the Haskell 98 spec, at least so that Haskell 98 compilers are compatible with each other. By all means emit a warning in this case (GHC does if you add -fwarn-name-shadowing), but it shouldn't be an error. Besides, it's inconsistent: I'm allowed to shadow 'f', but not 'x'. This is allowed: > module Rebind where > f x = x > where > f = True Cheers, Simon