caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] including signature (mli) in struct (ml)
@ 2004-08-18 22:52 Shaddin Doghmi
  2004-08-18 23:03 ` Kenneth Knowles
  0 siblings, 1 reply; 4+ messages in thread
From: Shaddin Doghmi @ 2004-08-18 22:52 UTC (permalink / raw)
  To: caml-list

let us say i have the following functor in a.ml:

module Make(In:sig blah end):Aout =blahblah

and the following functor in b.ml, which takes as input Aout:

module Make(In:Aout):Bout = blahblah

so basically, i have to be able to refer to Aout in b.ml . what im 
having to do is define Aout in a.ml using:

module type Aout = sig blahblah end

and then repeating that definition in a.mli in order to export Aout so i 
can refer to it in b.ml

this redundancy can be annoying, is there a way to declare Aout only 
once and still be able to refer to it in b.ml ? How about including 
a.mli in a.ml somehow? something along the lines of include in C would 
do it, where including a.h in a.c would make it unnecessary to define 
something in both...

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] including signature (mli) in struct (ml)
  2004-08-18 22:52 [Caml-list] including signature (mli) in struct (ml) Shaddin Doghmi
@ 2004-08-18 23:03 ` Kenneth Knowles
  2004-08-18 23:44   ` brogoff
  0 siblings, 1 reply; 4+ messages in thread
From: Kenneth Knowles @ 2004-08-18 23:03 UTC (permalink / raw)
  To: Shaddin Doghmi; +Cc: caml-list

On Wed, Aug 18, 2004 at 06:52:35PM -0400, Shaddin Doghmi wrote:
> this redundancy can be annoying, is there a way to declare Aout only 
> once and still be able to refer to it in b.ml ? How about including 
> a.mli in a.ml somehow? something along the lines of include in C would 
> do it, where including a.h in a.c would make it unnecessary to define 
> something in both...

Someone may have a more elegant solution to this, but when I have a bunch of
types that I don't want to have to repeat, I put them in a .ml file without a
corresponding .mli file.

Kenn

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] including signature (mli) in struct (ml)
  2004-08-18 23:03 ` Kenneth Knowles
@ 2004-08-18 23:44   ` brogoff
  2004-08-22 22:19     ` Stefano Zacchiroli
  0 siblings, 1 reply; 4+ messages in thread
From: brogoff @ 2004-08-18 23:44 UTC (permalink / raw)
  To: Kenneth Knowles; +Cc: Shaddin Doghmi, caml-list

On Wed, 18 Aug 2004, Kenneth Knowles wrote:
> On Wed, Aug 18, 2004 at 06:52:35PM -0400, Shaddin Doghmi wrote:
> > this redundancy can be annoying, is there a way to declare Aout only
> > once and still be able to refer to it in b.ml ? How about including
> > a.mli in a.ml somehow? something along the lines of include in C would
> > do it, where including a.h in a.c would make it unnecessary to define
> > something in both...
>
> Someone may have a more elegant solution to this, but when I have a bunch of
> types that I don't want to have to repeat, I put them in a .ml file without a
> corresponding .mli file.

If it's just types (not exceptions) I find it a bit more suggestive to put them
in a .mli file. Not much difference.

-- Brian

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] including signature (mli) in struct (ml)
  2004-08-18 23:44   ` brogoff
@ 2004-08-22 22:19     ` Stefano Zacchiroli
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Zacchiroli @ 2004-08-22 22:19 UTC (permalink / raw)
  To: caml-list

On Wed, Aug 18, 2004 at 04:44:22PM -0700, brogoff wrote:
> If it's just types (not exceptions) I find it a bit more suggestive to
> put them in a .mli file. Not much difference.

Not really, putting them in a .mli has the additional advantage to avoid
link order issues.

Cheers.

-- 
Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. -!-

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-08-22 22:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-18 22:52 [Caml-list] including signature (mli) in struct (ml) Shaddin Doghmi
2004-08-18 23:03 ` Kenneth Knowles
2004-08-18 23:44   ` brogoff
2004-08-22 22:19     ` Stefano Zacchiroli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).