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 BAA00647 for caml-redistribution; Sat, 12 Jun 1999 01:07:15 +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 UAA09066 for ; Wed, 9 Jun 1999 20:44:34 +0200 (MET DST) Received: from hermes.ccrl.nj.nec.com (hermes.ccrl.nj.nec.com [138.15.101.93]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id UAA11035 for ; Wed, 9 Jun 1999 20:44:32 +0200 (MET DST) Received: from flame.ccrl.nj.nec.com (flame.ccrl.nj.nec.com [138.15.103.79]) by hermes.ccrl.nj.nec.com (1.00/LJF980616) with SMTP id OAA09751 for ; Wed, 9 Jun 1999 14:43:00 -0400 (EDT) Received: from localhost by flame.ccrl.nj.nec.com (SMI-8.6/SMI-SVR4) id OAA11772; Wed, 9 Jun 1999 14:38:23 -0400 Date: Wed, 9 Jun 1999 14:38:22 -0400 (EDT) From: Junbiao Zhang X-Sender: junzhang@flame To: caml-list@inria.fr Subject: forward function definitions Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis 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. --Junbiao My current solution is really ugly: let a_forward_ref = (ref (fun _ -> raise (Failure "undefined") : int -> unit));; let register_signals () = ..... Sys.signal Sys.sigalrm (Sys.Signal_handle !a_forward_ref) ..... ......... let a sigid = ...... let assign_a_forward_ref () = a_forward_ref := ref a And im main()(may be in another file): ...... assign_a_forward_ref () ...... I must be missing something or this language is:)