RE: What's in an interface? Unnecessary recompilation again

2000-04-19 Thread Simon Peyton-Jones

Fair enough.  But would you like to suggest an algorithm GHC could use
to decide what to put in the .hi file?  You can't be suggesting that
it parse literal strings??

| -Original Message-
| From: George Russell [mailto:[EMAIL PROTECTED]]
| Sent: 14 April 2000 13:49
| To: [EMAIL PROTECTED]
| Subject: What's in an interface? Unnecessary recompilation again
| 
| 
| Changed .hi files are a nuisance because they make Make rerun 
| all GHC compilations
| which import the relevant module.   I thought I would not 
| have .hi changing
| today when I modified the implementation of an interface, but it did.
| According to -hi-diffs the difference is:
| 
| 
|   1 lvl18 :: [PrelBase.Char] {-## __A 0 __U 
| (PrelBase.unpackCStringzh "execOneWayCmd ") ##-} ;
| ! 1 lvl20 :: [PrelBase.Char] {-## __A 0 __U 
| (PrelBase.unpackCStringzh "Expect.hs:441|case") ##-} ;
|   1 lvl22 :: RegularExpression.MatchResult - PrelIOBase.IO 
| [PrelBase.Char] {-## __A 1 __S L __U (\ matchResult :: 
| RegularExpression.MatchResult - return @ [PrelBase.Char] 
| (case matchResult of wild { RegularExpression.MatchResult ds1 
| matched ds2 ds3 - matched })) ##-} ;
| --- 29,31 
|   1 lvl18 :: [PrelBase.Char] {-## __A 0 __U 
| (PrelBase.unpackCStringzh "execOneWayCmd ") ##-} ;
| ! 2 lvl20 :: [PrelBase.Char] {-## __A 0 __U 
| (PrelBase.unpackCStringzh "Expect.hs:461|case") ##-} ;
|   1 lvl22 :: RegularExpression.MatchResult - PrelIOBase.IO 
| [PrelBase.Char] {-## __A 1 __S L __U (\ matchResult :: 
| RegularExpression.MatchResult - return @ [PrelBase.Char] 
| (case matchResult of wild { RegularExpression.MatchResult ds1 
| matched ds2 ds3 - matched })) ##-} ;
| 
| If you ignore the lines of context etcetera, you'll see that 
| the difference is
| only in a line number "Expect.hs:441" rather than 
| "Expect.hs:461".  I submit, mlud,
| that line numbers are not something the importing module 
| needs to know about, and
| that therefore the location might be better off not inlined . . .
| 




Re: What's in an interface? Unnecessary recompilation again

2000-04-19 Thread George Russell

Simon Peyton-Jones wrote:
 
 Fair enough.  But would you like to suggest an algorithm GHC could use
 to decide what to put in the .hi file?  
Well that's a big question.  As I understand it, the errant value,
lvl20, is a string representing an error message (which I suppose is to
be thrown in the event of a matching failure).  Since it should
only be used on error, surely there is no speed benefit to inlining it,
and probably there is a space penalty (since you store the string 
multiple times).  In this case there is a very real disadvantage, since
inlining forces everything that imports that module to recompile.  So
my suggestion would be that values required only for errors should never
be inlined or put in a .hi file.