Delivered-To: lablgtk at yquem.inria.fr Date: Tue, 30 Oct 2007 11:22:46 +0900 (JST) Message-Id: <20071030.112246.94981046.garrigue at math.nagoya-u.ac.jp> To: d0 at wp.pl Subject: Re: [Lablgtk] Signals - how to inherit GObj.gobject_signals properly? From: Jacques Garrigue In-Reply-To: References: Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Cc: lablgtk at math.nagoya-u.ac.jp Content-Type: Text/Plain; charset=us-ascii Content-Length: 1962 From: Dawid Toton > --- in gPrintOperation.mli ( > http://www.toton.2-0.pl/OCaml/LablGTK/src/GtkPrintOperation/Output/gPrintOperation.mli > ): > class print_operation_signals : > [>GtkPrintOperation_types.print_operation] Gobject.obj -> object > inherit [[> GtkPrintOperation_types.print_operation]] GObj.gobject_signals > inherit OgtkPrintOperationProps.print_operation_sigs > end > > I believe there is something wrong with my interface part, but I don't > know what's going on at all. I thought that the compiler should know > that 'b and 'd types (as in the error message) should be the same type. > I don't know any way to force it to think so. Indeed, your interface is wrong. This should be class print_operation_signals : ([>GtkPrintOperation_types.print_operation] as 'a) Gobject.obj -> object inherit ['a] GObj.gobject_signals inherit OgtkPrintOperationProps.print_operation_sigs end That is, you have to share the type of the argument with the parameter of GObj.gobject_signals. > One thing more I don't understand worries me: why it is legal to write > inherit [[> GtkPrintOperation_types.print_operation]] GObj.gobject_signals > > when "[[> GtkPrintOperation_types.print_operation]] > GObj.gobject_signals" is sort of Gobject.obj->object and needs to be > feeded with some obj to become an OCaml object (that surely can be > inherited). > Now it looks as if it inherits "Gobject.obj->object" function. The keyword inherit is confusing. Personally, I would have preferred something like "include", because this is just about including the class type associated to GObj.gobject_signals, not inheriting from the class itself. And a class type has no arguments (there is no concept of "functor type" for classes), so you can include it directly. Jacques _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk