Not all GHC flags called dynamic are really dynamic
Summary
Not all GHC flags called dynamic
are really dynamic!
Description
GHC currently has 2 kinds of flags:
-
Mode
: A mode may be used on the command line only. You can pass only one mode flag. -
Dynamic
: A dynamic flag may be used on the command line, in aOPTIONS_GHC
pragma in a source file, or in a:set
command in GHCi.
However, GHC has some dynamic flags that are not so dynamic:
- They can only be set at startup.
- They can be combined with other mode or dynamic flags.
- But they can't change after GHC(i) has started..
Ticket #19299 (closed) shows two examples, -fexternal-interpreter
and -prof
.
Proposed solution:
We need a third category of GHC(i) flags, called static
. A static flag
- can only be set before startup from the command line.
- can't be set per module with a
OPTIONS_GHC
pragma. - can't be changed with a GHCi
:set
command during a GHCi session. - There can be several of static flags on the command line.
Currently if you (re)set such a static option in GHCi or in a OPTIONS_GHC
pragma, you either get an error message, or the setting is silently ignored.
GHC(i) should reject these static
flags in a GHCi :set
command or in a OPTIONS_GHC
pragma!
PS: This ticket is a replacement for #19299 (closed)