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
How important are circular lists/recursive objects?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-10-08 (09:57)
From: Andreas Rossberg <rossberg@m...>
Subject: Re: [Caml-list] Re: How important are circular lists/recursive objects?
skaller wrote:
>>> Note that stuff like:
>>> 	let rec x= (1,x)
>>> is not generally allowed: in functional terms it is ill-defined,
>> It is disallowed in OCaml because it has a cyclic type, not because it is
>> a cyclic value. Try with "ocaml -rectypes".
> lists have cyclic types too, they're not disallowed!

Technically speaking they haven't, because conventional variant types 
are nominal, not structural.

In any case, even OCaml without -rectypes allows some cyclic types (if 
the cycle goes through an object or polymorphic variant type), but not 
arbitrary ones. That is a pragmatic design decision to avoid too many 
bogus examples to type-check.

- Andreas