Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: circular types?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Tom Hirschowitz <hirschow@m...>
Subject: Re: circular types?
Hendrik Tews writes :
I would like to have recursive types spread over different files
like ....

That should be possible, but again there will be a mixing step, 
creating
a new module, in which the different parts of your recursive types 
block
are linking together.

In your example, you would have :


========== file types.ml

? type formula

type types =
  | Product of types list
  ...
  | Comprehension of formula

===================================

========== file expression.ml

? type formula

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

===================================

========== file formula.ml

? type expression

type formula = 
  | Forall of (string * types) list * formula
  ...
  | Expression of expression

===================================

========== file next.ml

module MyTypes = Types + Expression + Formula;;

...

===================================

Is it enough?


> It would be great if one could incorporate a class into the
> recursion. But I guess as a first step one has to allow recursion
> between classes and types in one module as in

>     type t = ....

>     and class c = ...

>     and type t' = ...

I'm not here until now, since in the prototype, there are only 
recursive values. But probably O-people at Cristal could answer this 
point.

Bye,

Tom