> >> The simplest approach would be to take the presence of -o as a
> >> strong hint that there might be confusion about executables/Main
> >> modules and thus to rename the Main.hi-file as well when -o is 
> >> present.
> >What you're really doing here is building a library that is 
> subsequently
> >used when building two separate executables.  The right 
> thing to do is
> >to build the executables with the objects in different places (the
> >interface is really part of the object code).
> 
> I agree that the interface is part of the object code - 
> that's why I'd prefer
> for both to follow the same naming convention.

But they do follow the same naming convention - did you read the section
in the User's Guide?  The rules are very simple, and are exactly the
same for both interfaces and objects, modulo the different flag names:
-odir/-hidir and -osuf/-hisuf.

I've just taken a look at the HaRe build, and you may indeed have found
a bug in 6.2.  It shouldn't complain about missing interface files.
This is strange, because I can't repeat it with a small example, so we
need to investigate further.

> I was trying to build the
> executables in different places, using -o. That used to work, 
> now it doesn't.
> 
> >I'm reluctant to change these rules in anything but small 
> ways, because
> >doing so inevitably breaks someone else's strange build system.  The
> >problem is that there are lots of different scenarios under which the
> >compiler has to do something reasonable and it's really hard (from
> >experience!) to change things in a way that doesn't upset anyone.
> 
> Just for the record: I was reporting just such a breakage. 
> But that's no
> reason to introduce more trouble - just take the suggestion as such,
> and decide whether or not it makes sense/would be an improvement.

The problem is that it's difficult to decide whether something is an
improvement, because of the large number of different scenarios that
have to work.  You should get together with Henrik Nillson and argue
about this one, then come back to me with your conclusions :-P

The reason things changed in 6.2 is that 6.0.1 had a number of bugs in
this area and we took the opportunity to try to design a policy that was
both simple to describe and behaved reasonably in all the cases we knew
about.

> >For instance, if I make -o change the location of the 
> interface file for
> >Main only, then don't I have to write special Makefile rules to take
> >into account this special case or does it only apply to --make?  This
> >sounds like a rather hacky special case to me.
> 
> Main _is_ special in that it is the only module not "required" to be
> in a file of the same name. But I don't see the need for any special
> cases? Ah, is it because -o not only applies to .o files and because
> -ohi is not taken into account for locating old interfaces?

We don't like to think of Main being special, except in the sense that
Main.main is the default entry point for an executable.  Any source file
specified on the command line of a --make compilation, or in a :load in
GHCi, can have a different filename from its module name.  We call these
"root modules" - Main is the most common one of course.

> My suggestion would be to let the name of the interface file follow
> the name of the object file, so if -o changes the name of 
> one, it should also change the name of the other.

Possibly a reasonable suggestion, but there are a few things that bother
me:

  - how exactly should the name of the interface be derived from
    the filename given to -o? 

  - I can already use -ohi to do this, so why should I need extra
    magical behaviour in -o? (remember, simple and easy to describe
    is to be preferred over do-what-I-want special cases).

  - this doesn't affect your HaRe build as far as I can see, because
    you use -o to specify the executable name, not an object file. So
    how do you think it would solve your problem?

> At the least, though, I'd expect to
> be able to use -ohi in the same way as -o, so that I can 
> force the effect
> if it's not standard. But that's just a suggestion.

Hmm, I *think* what you mean is that you want -ohi to rename the
interface fot the root module in a --make compilation, right?

> PS It just occurred to me that the new "-main-is" might be of help.
>       And if it isn't, I can still remove Main.hi between 
>       compilations..

Both of these solutions are good.

Cheers,
        Simon
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to