caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Tom Hirschowitz <hirschow@mouton.inria.fr>
To: caml-list@inria.fr
Subject: Re: circular types?
Date: Thu, 26 Oct 2000 11:11:49 +0200	[thread overview]
Message-ID: <200010260911.e9Q9Bnb07386@concorde.inria.fr> (raw)
In-Reply-To: Your message of "Thu, 26 Oct 2000 10:39:56 +0200." <200010260839.KAA11636@ithif20.inf.tu-dresden.de>

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

> - If I want to program a function typecheck (which recursively
> walks down formulas, expressions, and types) I separate it into
> typecheck_formula, typecheck_expression, etc and put these
> functions into the respective files. Will there be lightweight
> syntax for the forward declaration of typecheck_expression in
> file formula.ml similar to what you used for the types above? 

Yes. You'll have to specify the type of deferred functions in each 
module.
For example,


   ========== file expression.ml
   
   ? type formula
   
   type expression =
     | Abstraction of (string * types) list * expression
     ....
     | Formula of formula

   ? val typecheck_formula : formula -> ...

   let rec typecheck_expression = ...
   
   ===================================
   
   ========== file formula.ml
   
   ? type expression
   
   type formula = 
     | Forall of (string * types) list * formula
     ...
     | Expression of expression
   
   
   ? val typecheck_expression : expression -> ...

   let rec typecheck_formula = ...

   ===================================
   
   ========== file next.ml
   
   module MyTypes = Types + Expression + Formula;;
   
   ...
   
   ===================================
 

should work.


> - Assume another module that uses typecheck_formula, does it have
> to "open" Formula or Next? 

Other modules using those functions have to open Next, 
because before the merging, none of those functions or types 
is really defined.
For instance, the type checker refuses "Formula.typecheck_expression".

> - How about link order? The mixin module is linked after all
> modules it mixes and all modules that use something of file
> formula or expression have to be linked after the mixing module?

I really don't know, haven't worked on it yet.
But one module should be able to be mixed with many others.
Assume you want to test two strategies for type-checking expressions, 
you would use the same Formula module for both. 
Does it fix any link order anyway?

> - (Impatiently) In which ocaml release can I expect the mixing
> modules?

Not yet for sure!
Ocaml v 24.12? 
Xavier?






  reply	other threads:[~2000-10-26 14:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-24  8:48 Tom Hirschowitz
2000-10-26  8:39 ` Hendrik Tews
2000-10-26  9:11   ` Tom Hirschowitz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-10-23  7:43 Tom Hirschowitz
2000-10-23 15:35 ` Brian Rogoff
2000-10-25 14:03   ` John Max Skaller
2000-10-25 19:47     ` Brian Rogoff
2000-10-26  9:12     ` Hendrik Tews
2000-10-26 16:37       ` John Max Skaller
2000-10-24  8:37 ` Hendrik Tews
2000-10-25 14:31   ` John Max Skaller
2000-10-26  8:51     ` Hendrik Tews
2000-10-20  2:35 Chris Hecker
2000-10-20 12:24 ` Pierre Weis
2000-10-20 21:34   ` Chris Hecker
2000-10-21  8:02     ` Pierre Weis
2000-10-21 18:37       ` Chris Hecker
2000-10-21 12:22     ` Vitaly Lugovsky
2000-10-21 18:29       ` Chris Hecker
2000-10-21 22:36     ` Brian Rogoff
2000-10-23 18:43     ` Anton Moscal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200010260911.e9Q9Bnb07386@concorde.inria.fr \
    --to=hirschow@mouton.inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).