Date: Sat, 03 May 2003 13:19:52 +0200 Message-ID: From: Jun.Furuse at inria.fr To: Richard Jones Cc: lablgtk at kaba.or.jp Subject: Re: More GtkHtml questions In-Reply-To: <20030503100346.GE24136 at redhat.com> References: <20030503100346.GE24136 at redhat.com> MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII Hello, > Now to define my class: > > class html obj = object > inherit GPack.layout (obj : GtkHtml.html obj) > end > > Except this doesn't actually work. I get: > > File "gHtml.ml", line 40, characters 24-27: > This expression has type GtkHtml.html Gtk.obj but is here used with type > Gtk.layout Gtk.obj > Type GtkHtml.html = [ `base | `container | `html | `layout | `widget] > is not compatible with type > Gtk.layout = [ `base | `container | `layout | `widget] This is normal, since layout is defined as a terminal class in gPack.mli: class layout : Gtk.layout obj -> object inherit container_full val obj : Gtk.layout obj ... end This means that the argument for new GPack.layout must be Gtk.layout obj and nothing else. If you want to create a new class inherited from layout, I guess you have to modify the definition of layout class type, so that it can take an argument whose type is wider than Gtk.layout = [`base|`container|`layout|`widget]. I think it will be as follows: class layout : 'a obj -> object inherit container_full constraint 'a = [> Gtk.layout] val obj : 'a obj ... end The class defintion of GContainer.container may be a good example. # Jacques can surely give us a better comment than this, # but he is in vacation now... Let's wait his return. -- Jun