Placement of OPTION pragmas

nilsson at cs.yale.edu nilsson at cs.yale.edu
Thu Sep 18 15:14:19 EDT 2003


Sven Panne wrote:

> ... and I think it is fine that way, I would even be happy if it had
> to be the very first line. OPTIONS can change the language (well, at
> least in parts), so they should be placed in a prominent place. It
> would be easy to change GHC's behaviour the way you asked for, but
> this would make things hard for a *human* reader of the source code.

But different people may have different opinions on what should go into
the most prominent place in a file. Moreover, there is only one first
line, and assuming some kind of language pragma is introduced, and assuming
Simon Marlow goes ahead and introduces GHC_OPTIONS, and the other implementors
goes ahead and introduces HUGS_OPTIONS, NHC_OPTIONS, etc., insisting on all
of these being on the first line is obviously not going to work.

Morover, extending the current rule to work in this (as yet hypothetical)
setting seems a bit complicated. It seems to me that the easiest would be to
count comments  (including pragmas) as blank lines, and simply insisting
that this kind of pragmas occur before the first non-blkank line. Also, if
something like the language pragma is introduced and/or compiler-specific
option pragmas in the interest of facilitating writing portable code, then
the various Haskell implementation also have to agree on this rule, and
making that rule as simple and as intuitive as possible seems like a good
idea.

All the best,

/Henrik

-- 
Henrik Nilsson
Yale University
Department of Computer Science
nilsson at cs.yale.edu


More information about the Glasgow-haskell-users mailing list