From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA29865 for caml-redistribution; Thu, 17 Jun 1999 17:47:53 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA24493 for ; Thu, 17 Jun 1999 10:44:46 +0200 (MET DST) Received: from maxime.u-strasbg.fr (maxime.u-strasbg.fr [130.79.75.36]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id KAA03020; Thu, 17 Jun 1999 10:44:44 +0200 (MET DST) Received: (from luther@localhost) by maxime.u-strasbg.fr (8.8.7/8.8.7) id KAA29134; Thu, 17 Jun 1999 10:46:13 +0200 (MET DST) Message-ID: <19990617104613.A29113@maxime.u-strasbg.fr> Date: Thu, 17 Jun 1999 10:46:13 +0200 From: Sven LUTHER To: Pierre Weis , luther sven Cc: caml-list@inria.fr, luther@dpt-info.u-strasbg.fr Subject: Re: forward function definitions Reply-To: luther@dpt-info.u-strasbg.fr References: <19990616150347.C6385@steed.u-strasbg.fr> <199906162055.WAA22149@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2 In-Reply-To: <199906162055.WAA22149@pauillac.inria.fr>; from Pierre Weis on Wed, Jun 16, 1999 at 10:55:31PM +0200 Sender: weis On Wed, Jun 16, 1999 at 10:55:31PM +0200, Pierre Weis wrote: > > Ah, but you can define a wrapper immediately following the definition of the forwarder function : > > > > let f for () = ... > > > > ... > > > > let for ... = ... > > let true_f = f for > > > > Friendly, > > > > Sven LUTHER > > Yes you can do so, but you once again get the same polymorphism > problem: > 1) If for is used polymorphically in the body of f you're dead. > 2) true_f will be monomorphic as well, unless you eta-expand it as in: > let true_f () = f for () Ok, true, but it solves the lisibility problem. I have a similar problem : i am intenting to write a little function, using the mlgtk gtk+ bindings, that will popup a dialog window and ask the user for a string. The dialog window will activate a callback when i type enter in the entry widget. here is what i plan to do : let todo = ref None let activate entrywidget = let s = (* stuff to get the string in the entry widget *) in match !todo with | None -> raise Error | Some f -> f s let get_string f = match !todo with | Some f' -> () | None -> let () = todo := Some f in (* stuff to open the dialog box, * and connect the activate handler to it *) is this the best way to do things like that, what other possibilities are there ? Friendly, Sven LUTHER