Date: Fri, 13 Aug 2004 11:01:10 +0900 (JST) Message-Id: <20040813.110110.10654368.garrigue at kurims.kyoto-u.ac.jp> To: andrieu at ijm.jussieu.fr Cc: seguso.forever at tin.it, lablgtk at kaba.or.jp Subject: Re: (errata corrige) Screen for GtkWindow not set --- Warning: this expression should have type unit. From: Jacques GARRIGUE In-Reply-To: <20040812.131718.74755885.oandrieu at nerim.net> References: <200408091552.53159.seguso.forever at tin.it> <20040812.131718.74755885.oandrieu@nerim.net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Olivier Andrieu > Maurizio Colucci [Mon, 9 Aug 2004]: > > I am getting these warnings: > > > > ocamlc -I /usr/lib/ocaml/3.08/lablgl -I /usr/lib/ocaml/3.08/lablgtk2 > > lablgtk.cma lablgl.cma adv.ml > > File "adv.ml", line 36, characters 2-52: > > Warning: this expression should have type unit. > > File "adv.ml", line 37, characters 2-42: > > Warning: this expression should have type unit. > > File "adv.ml", line 39, characters 2-40: > > Warning: this expression should have type unit. > > File "adv.ml", line 40, characters 2-49: > > Warning: this expression should have type unit. > > that's because connecting signals returns a GtkSignal.id (it can be > used to deconnect a signal). In your program you are discarding this > value so ocaml emits a warning. Either compile your code with -w s or > write it like this: > > let _ = window#connect#destroy ~callback:Main.quit in > let _ = button#connect#clicked ... The politically correct way is ignore (window#connect#destroy ~callback:Main.quit); ignore (button#connect#clicked ...); ... It checks for partial applications, which "let _ =" doesn't. But I'm not politically correct, and I use "-w s", which keeps checks for partial applications, but allows returning non-unit results. Jacques