Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Re: type declaration in */mli & *.ml
@ 1997-10-01 10:02 Hendrik Tews
  1997-10-04 15:14 ` kahl
  0 siblings, 1 reply; 6+ messages in thread
From: Hendrik Tews @ 1997-10-01 10:02 UTC (permalink / raw)
  To: caml-list-request

Hi,

I am writing again about a topic we had on the list last year
(cf. http://pauillac.inria.fr/caml/caml-list/0676.html and
http://pauillac.inria.fr/caml/caml-list/0680.html).

As Xavier writes it is a pain that in some circumstances
(specifications of types and signatures) the same code has to be
written twice, first in the specification and then in the
implementation.

Is there any solution to this? 

Has anybody tried to include parts of an interface into an
implementation (for instance by means of a preprocessor)?

Greetings,

Hendrik

-------------------------------------------------------------
e-mail:   tews@tcs.inf.tu-dresden.de
www:      http://wwwtcs.inf.tu-dresden.de/~tews
-------------------------------------------------------------





^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: type declaration in */mli & *.ml
@ 1997-10-03 16:34 Manuel Fahndrich
  1997-10-06 11:51 ` U-E59264-Osman Buyukisik
  0 siblings, 1 reply; 6+ messages in thread
From: Manuel Fahndrich @ 1997-10-03 16:34 UTC (permalink / raw)
  To: caml-list


Hendrik Tews <tews@tcs.inf.tu-dresden.de> wrote

[...]
>Has anybody tried to include parts of an interface into an
>implementation (for instance by means of a preprocessor)?

I've seen SML programs written using NoWeb, a variant of Knuth's
literate programming tool Web. The tool acts as a preprocessor and
makes it easy to write type declarations only once, and use them in
signatures and structures.

-Manuel






^ permalink raw reply	[flat|nested] 6+ messages in thread
* type declaration in */mli & *.ml
@ 1996-10-21  9:23 Basile STARYNKEVITCH
  1996-10-23  9:29 ` Xavier Leroy
  0 siblings, 1 reply; 6+ messages in thread
From: Basile STARYNKEVITCH @ 1996-10-21  9:23 UTC (permalink / raw)
  To: caml-list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]



Hello All,

It seems that when a type is declared in the interface of a module Moo
-ie in the file moo.mli- it should also be declared in the
implementation of the same module Moo -ie in the file moo.ml-.

For instance, in directory ocaml-1.02/toplevel the file toploop.mli
contains

(*################ from toplevel/toploop.mli *)

(* Interface with toplevel directives *)

type directive_fun =
    Directive_none of (unit -> unit)
  | Directive_string of (string -> unit)
  | Directive_int of (int -> unit)
  | Directive_ident of (Longident.t -> unit)


(*############### end of sample ################*)

while the file toploop.ml also contains

(*############# from toplevel/toploop.ml ################*)

type directive_fun =
    Directive_none of (unit -> unit)
  | Directive_string of (string -> unit)
  | Directive_int of (int -> unit)
  | Directive_ident of (Longident.t -> unit)

(*################ end of sample ################*)

I don't understand why is it so, and I feel such a redundancy is very
annoying.

Any hints or explanations?

(perhaps I could paraphrase my question: does an implementation file
moo.ml of a module Moo contain an implicit open Moo;; ??)

Thanks for reading.

N.B. Any opinions expressed here are solely mine, and not of my organization.
N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.

Please cite a *pertinent part* of my mail in all answers
Veuillez citer une *partie pertinente* de mon courrier dans vos reponses



----------------------------------------------------------------------
Basile STARYNKEVITCH   ----  Commissariat à l Energie Atomique 
DRN/DMT/SERMA * CEA/Saclay bat.470 * 91191 GIF/YVETTE CEDEX * France
fax: (33) 01,69.08.85.68; phone: 01,69.08.40.66; home: 01,46.65.45.53
email: Basile.Starynkevitch@cea.fr (or else basile@soleil.serma.cea.fr);  
I speak french, english, russian. Je parle français, anglais, russe.
----------------------------------------------------------------------






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

end of thread, other threads:[~1997-10-06 16:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-01 10:02 type declaration in */mli & *.ml Hendrik Tews
1997-10-04 15:14 ` kahl
  -- strict thread matches above, loose matches on Subject: below --
1997-10-03 16:34 Manuel Fahndrich
1997-10-06 11:51 ` U-E59264-Osman Buyukisik
1996-10-21  9:23 Basile STARYNKEVITCH
1996-10-23  9:29 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox