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 WAA21925 for caml-redistribution; Wed, 16 Jun 1999 22:55:43 +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 PAA07002 for ; Wed, 16 Jun 1999 15:04:02 +0200 (MET DST) Received: from steed.u-strasbg.fr (steed.u-strasbg.fr [130.79.7.10]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id PAA12691; Wed, 16 Jun 1999 15:04:00 +0200 (MET DST) Received: (from luther@localhost) by steed.u-strasbg.fr (8.8.7/8.8.7) id PAA06497; Wed, 16 Jun 1999 15:03:48 +0200 (MET DST) Message-ID: <19990616150347.C6385@steed.u-strasbg.fr> Date: Wed, 16 Jun 1999 15:03:47 +0200 From: luther sven To: Pierre Weis , luther@dpt-info.u-strasbg.fr Cc: caml-list@inria.fr Subject: Re: forward function definitions References: <19990614125538.B19275@maxime.u-strasbg.fr> <199906141617.SAA23666@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2 In-Reply-To: <199906141617.SAA23666@pauillac.inria.fr>; from Pierre Weis on Mon, Jun 14, 1999 at 06:17:22PM +0200 Sender: weis On Mon, Jun 14, 1999 at 06:17:22PM +0200, Pierre Weis wrote: > > On Wed, Jun 09, 1999 at 02:38:22PM -0400, Junbiao Zhang wrote: > > > Hi, > > > > > > We're developing a fairly large system with multiple function > > > definitions. It's inevitable that some functions may call other functions > > > defined later(may not even be recursive calls as in the case of > > > Sys.Signal_handle). My question is: how do I solve such a problem which is > > > extremely trival in other languages? Thanks. > > > > If the two functions are in different modules, just provide a interface file > > for them, and it should work ok but can cause some linker problems. > > > > 2 clean way of doing this are : > > > > * use the later called function as a parameter to the first called function : > > That's a neat solution, although this trick works only when the > ``later defined'' function is monomorphic, or at least is not > polymorphically called (the same problem arises with the reference > trick). Furthermore, this extra argument is a bit confusing, since, as > a forward, it should always be exactly the same value and nothing > helps the reader to understand this. Furthermore, the compiler has no > ways to warranty this semantics. 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