Runghc patch

Isaac Dupree isaacdupree at charter.net
Wed Aug 22 12:13:45 EDT 2007


Ian Lynagh wrote:
> On Wed, Aug 22, 2007 at 12:12:51PM -0300, Isaac Dupree wrote:
>> runghc -- -- -fglasgow-exts
>>
>> would be needed to run a file named "-fglasgow-exts", compared to
> 
> I don't think we should worry too much about making it easy for people
> to call their sources -fglasgow-exts.hs. In fact, I'm not even too
> bothered about people who want to pass -fglasgow-exts as a flag, rather
> than (a) using an OPTIONS_GHC pragma (b) using more specific -XFoo flags
> (c) using a more portable LANGUAGE Foo pragma.

Agreed.

>> In any case it seems like ghc ought to have a --run flag to make ghc 
>> itself run a file like runghc, similar to --interactive/ghci?
> 
> That might be nice: ghc GHCFLAGS --run MODULE PROGRAMFLAGS
> 
> However, runghc would still need to work out which GHC to run, and would
> still need to work out where to insert the "--run" in the arguments it
> is given.

Good point, GHC normally does not care about the order of its arguments, 
but running requires one source-file and arguments to _it_.  Most simply 
this would be

ghc --run GHCFLAGS MODULE -- PROGRAMFLAGS
or
ghc --run GHCFLAGS -- MODULE PROGRAMFLAGS

(--run just being another GHCFLAG that affects how the sequence of 
non-flag arguments is interpreted)

but arguably this isn't a very nice syntax (and especially not for 
runghc).  If --run (or some other name of a flag with that effect) also 
enabled the behavior of treating all arguments after a non-flag as 
non-flags (very weird!), then _runghc_ wouldn't actually have to be the 
one to work out where that division is: it could just insert --run at 
the beginning (and possibly remove -f/path/to/ghc or --).

Isaac



More information about the Cvs-ghc mailing list