Case of "Language" pragma - bug?

I'm using GHC 6.6.1. The manual says: "Pragmas all take the form {-# word ... #-} where word indicates the type of pragma, and is followed optionally by information specific to that type of pragma. Case is ignored in word." However, when I use "Language CPP" instead of "LANGUAGE CPP" in the pragma, the pragma is ignored. Is this a documentation bug? To test the problem, one can use "ghc --make testpragma1.hs" and "ghc --make testpragma2.hs" on the following: -- Robin Bate Boerop

-----Original Message----- From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell-users-bounces@haskell.org] On Behalf Of Robin Bate Boerop Sent: Tuesday, October 30, 2007 3:14 PM To: glasgow-haskell-users@haskell.org Subject: Case of "Language" pragma - bug? I'm using GHC 6.6.1. The manual says: "Pragmas all take the form {-# word ... #-} where word indicates the type of pragma, and is followed optionally by information specific to that type of pragma. Case is ignored in word." However, when I use "Language CPP" instead of "LANGUAGE CPP" in the pragma, the pragma is ignored. Is this a documentation bug? The interesting question is which way it should work. Obviously the documentation should match the code, but it isn't obvious (at least to me) whether it's better to modify the documentation or to change the behavior of the code. Is the behavior the same in the latest ghc release? Seth Kurtzberg Software Engineer Specializing in Security, Reliability, and the Hardware/Software Interface To test the problem, one can use "ghc --make testpragma1.hs" and "ghc --make testpragma2.hs" on the following:

| "Pragmas all take the form {-# word ... #-} where word indicates the type of | pragma, and is followed optionally by information specific to that type of | pragma. Case is ignored in word." | | However, when I use "Language CPP" instead of "LANGUAGE CPP" in the pragma, | the pragma is ignored. Is this a documentation bug? | | The interesting question is which way it should work. Obviously the | documentation should match the code, but it isn't obvious (at least to me) | whether it's better to modify the documentation or to change the behavior of | the code. Yes at the moment we allow LANGUAGE language but not Language or LanGUAge We'll probably just change the documentation unless people yell loudly Simon

Yes at the moment we allow LANGUAGE language but not Language or LanGUAge
We'll probably just change the documentation unless people yell loudly
<yelling volume="loudly"> Being allowed to write Language would be nice --- even if this is turned into the only accepted way. </yelling> (And yes, I will have to change almost all of my modules, but I also will want to change.) Wolfram

On Wed, Oct 31, 2007 at 02:46:13PM +0000, Malcolm Wallace wrote:
Yes at the moment we allow LANGUAGE language but not Language or LanGUAge
Being allowed to write Language would be nice
I concur. Surely it is easy to just (map toLower) over the pragma identifier before comparison with known pragma names?
Currently the lexer looks for them as regexps, e.g. "{-#" $whitechar* (LANGUAGE|language) { token ITlanguage_prag } I've filed a bug for this here: http://hackage.haskell.org/trac/ghc/ticket/1817 Thanks Ian

Hello Ian, Wednesday, October 31, 2007, 11:43:47 PM, you wrote:
Currently the lexer looks for them as regexps, e.g. "{-#" $whitechar* (LANGUAGE|language) { token ITlanguage_prag }
standard solution: [l|L][a|A]... -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Thanks for filing the bug, Ian.
On 31/10/2007, Ian Lynagh
On Wed, Oct 31, 2007 at 02:46:13PM +0000, Malcolm Wallace wrote:
Yes at the moment we allow LANGUAGE language but not Language or LanGUAge
Being allowed to write Language would be nice
I concur. Surely it is easy to just (map toLower) over the pragma identifier before comparison with known pragma names?
Currently the lexer looks for them as regexps, e.g. "{-#" $whitechar* (LANGUAGE|language) { token ITlanguage_prag }
I've filed a bug for this here: http://hackage.haskell.org/trac/ghc/ticket/1817
Thanks Ian
-- Robin Bate Boerop
participants (7)
-
Bulat Ziganshin
-
Ian Lynagh
-
kahl@cas.mcmaster.ca
-
Malcolm Wallace
-
Robin Bate Boerop
-
Seth Kurtzberg
-
Simon Peyton-Jones