Version française
Home     About     Download     Resources     Contact us    
Browse thread
Problem with recursive class and non-class types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Goswin von Brederlow <goswin-v-b@w...>
Subject: Problem with recursive class and non-class types
Hi,

I want to define the two types below:

type foo = { bar : bar; }
class bar = object val mutable foo : foo list = [] end

Is there another way of doing this other than:

# type 'a foo = { bar : 'a; } 
  class bar = object val mutable foo : #bar foo list = [] end;;
type 'a foo = { bar : 'a; }
class bar : object val mutable foo : #bar foo list end

I don't want any 'a foo other than 'a = #bar. It is too easy to create a
baz foo and then much later get a type error when trying to use it as
bar foo. I want the error where the foo gets created.

MfG
        Goswin