Delivered-To: lablgtk at yquem.inria.fr To: lablgtk at math.nagoya-u.ac.jp From: Dawid Toton Date: Tue, 30 Oct 2007 02:23:30 +0100 Lines: 65 Message-ID: Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Lablgtk] Signals - how to inherit GObj.gobject_signals properly? Content-Type: text/plain; charset=UTF-8; format=flowed Content-Length: 2744 I have stuck trying to understand the following error message: ...... The method connect has type 'a. ([> GtkPrintOperation_types.print_operation ] as 'b, 'a) GtkSignal.t -> callback:'a -> GtkSignal.id but is expected to have type 'c. ([> GtkPrintOperation_types.print_operation ] as 'd, 'c) GtkSignal.t -> callback:'c -> GtkSignal.id Type 'b = [> `printoperation | `printoperationpreview ] is not compatible with type 'd = [> `printoperation | `printoperationpreview ] (the whole message is here: http://www.toton.2-0.pl/OCaml/LablGTK/src/GtkPrintOperation/KillerErrorMessage.txt ) I'm trying to compile the following: --- in gPrintOperation.ml ( http://www.toton.2-0.pl/OCaml/LablGTK/src/GtkPrintOperation/Output/gPrintOperation.ml ): class print_operation_signals obj = object inherit [[> GtkPrintOperation_types.print_operation]] GObj.gobject_signals obj inherit OgtkPrintOperationProps.print_operation_sigs end --- 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 (other source files are in http://www.toton.2-0.pl/OCaml/LablGTK/src/GtkPrintOperation/Output/ ) 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. I've tried to mimic some existing code, but in gAction.mli there is declaration of action_signals that contains only 2 values an 2 methods. Should I show (in the interface) the parts inherited from gobject_signals ? If (in interface sourcecode) print_operation_signals doesn't inherit from gobject_signals, compiler tells me that there is a problem with the connect method. 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. Thank you in advance. I'm still working on GtkPrintOperation, but currently I don't know how to overcome the problem. Dawid Toton _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk