DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=oda3v4nM/c+wSNfA+9K3HKPaJ6ibZMlN2uMlXHN1SBWoUOaWra7utNwyJB7AgV2vyQ2+fpBIVG8ksThaPJbZ0xQVFfTHGpiwFuam91jomtHQKObUwkM3zERy9LkPxv/DvPOarFvNZET7dGY3CMbQgrBPueBb4wG1cZvXDl/92TM= Message-ID: <6b8a9142050910114072a5e441 at mail.gmail.com> Date: Sat, 10 Sep 2005 20:40:58 +0200 From: Remi Vanicat Reply-To: remi.vanicat at gmail.com To: "romildo at uber.com.br" Subject: Re: Wrapping a new widget Cc: lablgtk at math.nagoya-u.ac.jp In-Reply-To: <20050910174838.GA16269 at malaquias> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline References: <20050910174838.GA16269 at malaquias> Content-Transfer-Encoding: 8bit 2005/9/10, romildo at uber.com.br : > Hi. [...] > When compiling the test program with compiler > option -i, we can see the infered types of the > values: > > $ ocamlc -i lablgtk.cma gtkInit.cmo gExtra.cmo lablgtkextra.cma test-extra.ml -o test-extra > File "test-extra.ml", line 10, characters 2-50: > Warning: this expression should have type unit. > val window : GWindow.window > val canvas : GObj.widget > val main : unit -> unit > > I was expecting the type of canvas to be GExtra.plot_canvas > instead of GObj.widget. Please, help me to change > this program so that this is the case. Well, with you current definition of GExtra.plot_canvas, the type GExtra.plot_canvas and GObj.widget are equal, so there is no problem. You could define the plot_canvas function as let plot_canvas width heigth magnification ?packing ?show () : plot_canvas = let w = PlotCanvas.new_plot_canvas width heigth magnification in GObj.pack_return (new plot_canvas w) ~packing ~show if you realy want ocaml to use your type.