Simon Peyton Jones wrote:
> It was Just Too Painful to pass the flags everywhere. For example, deep in
> some dark corner of the transformation system there's a constant that
> says how big a function body can be before GHC inlines it. Threading
> the command-line arguments all the way to that site is desperately painful.
> It's even worse if you discover that you'd like a command-line-controllable
> thing in a dark corner that doesn't yet have the plumbing... you have to add
> an extra argument to a chain of functions all the way to the top.
>
I'd naively think that you could have put the flags in some structure
that's passed around anyway, like the symbol table? For example
just invent some identifier names that's not legal Haskell and put
the info there.
> Passing the flags around costs extra instructions (not many each time, but a
> lot of times). Furthermore, even the flag test is expensive. You can't
> pass 100 flags individually, so you pass a single value and do a lookup each
> time you want to test the flag. Contrast that with a global thunk that
> gets updated to a boolean the first time you use it.
>
Maybe the symbol table isn't passed around to all dark corners though.
Anyway, what it seems to me you lose by doing it the way you described
is that you are stuck again if some day you want to set those flags
some other way than from the environment variables. For example with
pragmas. You can't compile several modules with different settings
either, without restarting all of the compiler, it seems to me.
Sverker