|Version 3 (modified by malcolm.wallace@…, 9 years ago) (diff)|
Treatment of names beginning with underscore
It is a convention that the compiler will not warn about unused variables that begin with an underscore. An underscore also counts as a lower case letter meaning that you cannot start type, class, or data constructors with it.
Make underscore 'caseless' meaning when deciding whether a name is a constructor or not, look through underscores. so
data Foo = Foo | _Bar -- ^ _Bar possibly unused
will be valid.
we can either treat identifiers containing only underscores as lowercase names or invalid depending on how important the ability to obfscusiate code is to us. (or a composite number of them being a variable and a prime number of them being a constructor if we really really want to allow obfscusiated code :) )
The leading underscore convention is not only useful as a way to suppress warnings, but as a form of documentation that we expect a name to be unused so being able to use it in these cases would be helpful.
Caseless underscore is implemented in nhc98 by default, H'98 behaviour requires the -underscore option.