Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Problem with recursive class and non-class types
@ 2010-05-20  5:12 Goswin von Brederlow
  2010-05-20  7:39 ` [Caml-list] " Jacques Garrigue
  0 siblings, 1 reply; 3+ messages in thread
From: Goswin von Brederlow @ 2010-05-20  5:12 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-21 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-20  5:12 Problem with recursive class and non-class types Goswin von Brederlow
2010-05-20  7:39 ` [Caml-list] " Jacques Garrigue
2010-05-21 18:01   ` Goswin von Brederlow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox