Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* storing object in record
@ 2009-04-08  7:36 Michael
  2009-04-08  7:54 ` [Caml-list] " Jérémie Dimino
  0 siblings, 1 reply; 4+ messages in thread
From: Michael @ 2009-04-08  7:36 UTC (permalink / raw)
  To: caml-list


it seems that I'm not able to figure out how to do  this:

class baseclass = object(this)
  method asBase = (this :> baseclass)
(* ... *)	
end;;

class ex = object inherit baseclass method name = "ex" end

type state_rec = { mutable state:  'a. #baseclass as 'a };;


this gives an error:

let x = new ex;;

{ state = x };;
Error: This field value has type ex which is less general than
         'a. #baseclass as 'a

or:

{ state = x#asBase };;
Error: This field value has type baseclass which is less general than
         'a. #baseclass as 'a

or:

type state_rec = { mutable state:  'a. < asBase: baseclass;..> as 'a };;
gives:
Error: Unbound type parameter ..


what I'm missing here?

cheers
 Michael




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

end of thread, other threads:[~2009-04-08 11:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-08  7:36 storing object in record Michael
2009-04-08  7:54 ` [Caml-list] " Jérémie Dimino
2009-04-08 10:29   ` Michael
2009-04-08 11:36     ` Jérémie Dimino

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