* [Caml-list] -i option to compiler
@ 2002-01-09 21:19 Ian Zimmerman
2002-01-09 21:30 ` David Monniaux
0 siblings, 1 reply; 5+ messages in thread
From: Ian Zimmerman @ 2002-01-09 21:19 UTC (permalink / raw)
To: OCAML
Hi, I remember using the -i option successfully in the past to
generate a fat interface to an existing .ml file. However, after
upgrading to 3.04 and trying to recompile some of my stuff, I can't
seem to remember how to do without an excessive amount of pain.
I have a file foo.ml, and I want to generate foo.mli.
kronstadt:~$ cat >>foo.ml
let i = 1
kronstadt:~$ ocamlc -i foo.ml > foo.mli
I/O error: foo.cmi: No such file or directory
kronstadt:~$ ocamlc -i -c foo.ml > foo.mli
I/O error: foo.cmi: No such file or directory
kronstadt:~$ ocamlc -c foo.ml
I/O error: foo.cmi: No such file or directory
kronstadt:~$ rm foo.mli
kronstadt:~$ ocamlc -c foo.ml
kronstadt:~$ ls -l foo.cmo
-rw-rw-r-- 1 itz itz 145 Jan 9 13:14 foo.cmo
kronstadt:~$ ocamlc -i -c foo.ml > foo.mli
kronstadt:~$ ls -l foo.cmo
-rw-rw-r-- 1 itz itz 147 Jan 9 13:15 foo.cmo
kronstadt:~$
So, it seems that I have to first _compile_ foo.ml to get both foo.cmi
and foo.cmo, and then compile it _again_ with the -i flag to get
foo.mli. Is that so? Isn't there a way to generate _just_ foo.mli
and not the object file?
--
Ian Zimmerman, Oakland, California, U.S.A.
GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087
In his own soul a man bears the source
from which he draws all his sorrows and his joys.
Sophocles.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] -i option to compiler
2002-01-09 21:19 [Caml-list] -i option to compiler Ian Zimmerman
@ 2002-01-09 21:30 ` David Monniaux
2002-01-09 23:13 ` Eric C. Cooper
0 siblings, 1 reply; 5+ messages in thread
From: David Monniaux @ 2002-01-09 21:30 UTC (permalink / raw)
To: Ian Zimmerman; +Cc: OCAML
On 9 Jan 2002, Ian Zimmerman wrote:
> kronstadt:~$ ocamlc -i foo.ml > foo.mli
> I/O error: foo.cmi: No such file or directory
This one is classical.
When you use > foo.mli, the shell creates foo.mli BEFORE running ocamlc.
So when ocamlc sees that there is a .mli file, it looks for the
corresponding .cmi and complains loudly that it does not exist.
The solution is to do
ocamlc -i foo.ml > foo.mli.tmp
mv foo.mli.fmp foo.ml
I guess that the compiler should accept a -output-mli option or something
similar, to avoid the above kludge.
David Monniaux http://www.di.ens.fr/~monniaux
Laboratoire d'informatique de l'École Normale Supérieure,
Paris, France
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] -i option to compiler
2002-01-09 21:30 ` David Monniaux
@ 2002-01-09 23:13 ` Eric C. Cooper
2002-01-09 23:24 ` Ian Zimmerman
0 siblings, 1 reply; 5+ messages in thread
From: Eric C. Cooper @ 2002-01-09 23:13 UTC (permalink / raw)
To: OCAML
On Wed, Jan 09, 2002 at 10:30:55PM +0100, David Monniaux wrote:
> I guess that the compiler should accept a -output-mli option or something
> similar, to avoid the above kludge.
Or just suppress the complaint in the case of an empty .mli file
created within the past few seconds.
--
Eric C. Cooper e c c @ c m u . e d u
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] -i option to compiler
2002-01-09 23:13 ` Eric C. Cooper
@ 2002-01-09 23:24 ` Ian Zimmerman
2002-01-10 1:57 ` Jacques Garrigue
0 siblings, 1 reply; 5+ messages in thread
From: Ian Zimmerman @ 2002-01-09 23:24 UTC (permalink / raw)
To: OCAML
David> I guess that the compiler should accept a -output-mli option or
David> something similar, to avoid the above kludge.
Eric> Or just suppress the complaint in the case of an empty .mli file
Eric> created within the past few seconds.
Even having been shown a fool, I have to disagree with both. :-)
The real root of the inconvenience is that the compiler treats -i runs
as normal compilations with just a silly side task to take care of.
Instead, it should just switch to a mode where generating the
interface is the _only_ thing it does, and overwrite an existing .mli
file if necessary (let user beware).
--
Ian Zimmerman, Oakland, California, U.S.A.
GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087
In his own soul a man bears the source
from which he draws all his sorrows and his joys.
Sophocles.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] -i option to compiler
2002-01-09 23:24 ` Ian Zimmerman
@ 2002-01-10 1:57 ` Jacques Garrigue
0 siblings, 0 replies; 5+ messages in thread
From: Jacques Garrigue @ 2002-01-10 1:57 UTC (permalink / raw)
To: itz; +Cc: caml-list
From: Ian Zimmerman <itz@speakeasy.org>
> The real root of the inconvenience is that the compiler treats -i runs
> as normal compilations with just a silly side task to take care of.
>
> Instead, it should just switch to a mode where generating the
> interface is the _only_ thing it does, and overwrite an existing .mli
> file if necessary (let user beware).
That seems reasonnable: I cannot actually imagine a situation where
one would want to produce both the .cmo and .mli simultaneously.
Making -i a compilation mode by itself would have the extra advantage
of avoiding to produce an a.out when one forgot the (meaningless) -c.
Jacques Garrigue
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-01-10 1:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-09 21:19 [Caml-list] -i option to compiler Ian Zimmerman
2002-01-09 21:30 ` David Monniaux
2002-01-09 23:13 ` Eric C. Cooper
2002-01-09 23:24 ` Ian Zimmerman
2002-01-10 1:57 ` Jacques Garrigue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox