Yes I've known about this for some time, and I was wondering when
someone would actually trip over it.  Your analysis is exactly correct.

It's not easy to fix, because it depends on the transitive closure of
every implementation thing funcA depends on.  It'd be a big nuisance to
track two kinds of version, just in case of TH.

And the benefit would be less, because the transitive-closure-of-impl
will change more often.

A crude but simple story could be: 
        with -fth, switch off fine-grain dependency tracking
        instead just use the modification dates on the files

Would that be better?

Simon

| -----Original Message-----
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-bugs-
| [EMAIL PROTECTED] On Behalf Of Duncan Coutts
| Sent: 26 May 2004 19:13
| To: [EMAIL PROTECTED]
| Subject: TH: --make does not detect changes in imported functions used
in asplice
| 
| Suppose we have
| 
| ModuleA.hs (and .o)
| exports funcA :: Something -> ExpQ
| 
| ModuleB.hs (and .o)
| has definition
| funcB = $(funcA something)
| 
| Now if we edit the implementation (but not the signature) of funcA in
| ModuleA.hs and run
| 
| $ ghc -fth --make ModuleB
| 
| then ModuleA is recomplied but ModuleB is not. However on deleting
| ModuleB.o and issuing the same command
| 
| $ ghc -fth --make ModuleB
| 
| then ModuleB is recompiled as expected but now we discover the mistake
| we made when editing funcA which manifests itself as a semantic/type
| error or some such in the code generated by funcA. The point being,
that
| this error was not detected the first time we recompiled because the
| dependency of funcB on funcA's implementation was not considered.
| 
| The problem of course is that using imported template programs depend
on
| their implementation not just their signature because we use the
| imported template programs to generate code in the current module
which
| can fail at compile time.
| 
| I don't know enough about ghc's .hi files to know if there's an easy
fix
| to this or not. My understanding is that .hi files contain a revision
| stamp on the interface description of functions (and other stuff like
| strictness etc) and modules get recompiled if any interfaces they use
| have changed. Perhaps it would be possible to add an implementation
| revision stamp too and modules would be recompiled if there has been
an
| implementation change of any imported function used withing a splice.
| 
| This might be too much pain for little gain.
| 
| Duncan
| 
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to