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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Anton Moscal <msk@p...>
Subject: Re: circular types?
On Fri, 20 Oct 2000, Chris Hecker wrote:

> 
> >It's exactly similar to value definitions: put a ``and'' between the
> >two recursive definitions.
> >type foo = B of bar
> >and bar = F of foo
> 
> Ah, thanks!  Is there any way to do it without the "and"?  In other words, what if I want to do this but the types are defined "far away" from each other in the source.  The "and" solution works, but I'm looking for something like forward declarations from C++:

There is no good solution. But may be the following can help you:

type 'bar foo = B of 'bar
...
type bar = F of bar foo

Regards, Anton