Re: [commit: ghc] master: Put the DynFlags in a global variable for tracing; fixes #7304 (f7cd14f)

Simon Marlow <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
On 08/10/2012 22:04, Ian Lynagh wrote:
> Repository : ssh://darcs.haskell.org//srv/darcs/ghc
>
> On branch  : master
>
> http://hackage.haskell.org/trac/ghc/changeset/f7cd14fd30d40ae7e904a533804f43d43dd8f439
>
>> ---------------------------------------------------------------
>
> commit f7cd14fd30d40ae7e904a533804f43d43dd8f439
> Author: Ian Lynagh <[email protected]>
> Date:   Mon Oct 8 21:55:23 2012 +0100
>
>      Put the DynFlags in a global variable for tracing; fixes #7304
>
>      This is an ugly kludge to make a DynFlags value available for the
>      'trace' functions. It may not be the value we really ought to use,
>      but it'll be good enough for the pretty-printer to use.
>
>      Ideally we'd pass the real DynFlags down to all the trace calls,
>      but this will do for now at least.

So this looks like a hack, but it's no worse than pprTrace itself.  I 
have no problems with it, because it means I can just use pprTrace 
wherever I like without having to plumb DynFlags to it.

I'd argue strongly against having to pass DynFlags to trace.  The whole 
point of pprTrace is that you can just throw new ones in for debugging - 
there are a few static to pprTrace in the code, but those aren't the 
ones we care about, it's the ability to quickly add new/temporary ones 
for debugging that matters.

Cheers,
	Simon



>   compiler/main/DynFlags.hs      |   30 +++++++-----------------------
>   compiler/main/DynFlags.hs-boot |    2 --
>   compiler/main/GHC.hs           |    2 +-
>   compiler/main/StaticFlags.hs   |   21 +++++++++++++++++++++
>   compiler/utils/Outputable.lhs  |    8 ++++----
>   5 files changed, 33 insertions(+), 30 deletions(-)
>
>
> Diff suppressed because of size. To see it, use:
>
>      git show f7cd14fd30d40ae7e904a533804f43d43dd8f439
>
> _______________________________________________
> Cvs-ghc mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/cvs-ghc
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.