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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Keiko Nakata <keiko@k...>
Subject: Re: [Caml-list] Recursive types
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>

> From: Swaroop Sridhar <swaroop@cs.jhu.edu>
> 
> > How are arbitrary recursive types implemented in caml? 
> 
> No, types are just implemented as (cyclic) graphs.
> All functions in the type checker have to be careful about not going
> into infinite loops. There are various techniques for that, either
> keeping a list/set of visited nodes, or using some mutable fields.

I am very interested in this subject.
Since 1) I can define type abbreviations almost artitrary,
as in  type t = < m : t > ; and 2) type abbreviations can have parameters
as in type 'a t = < m : 'a > , 
just keeping a list/set of visited nodes does not seem to be enough,
especially for structual types.
So I think the type checker does some very clever thing.

Regards,
Keiko.