Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: Chris Hecker <checker@d...>
Subject: Re: circular types?

>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++:

class foo;
class bar;
class foo { bar *Bar; };
// ...lots of stuff...
class bar { foo *Foo; };