Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: luther sven <luther@steed.u-strasbg.fr>
To: Pierre Weis <Pierre.Weis@inria.fr>, luther@dpt-info.u-strasbg.fr
Cc: caml-list@inria.fr
Subject: Re: forward function definitions
Date: Wed, 16 Jun 1999 15:03:47 +0200	[thread overview]
Message-ID: <19990616150347.C6385@steed.u-strasbg.fr> (raw)
In-Reply-To: <199906141617.SAA23666@pauillac.inria.fr>; from Pierre Weis on Mon, Jun 14, 1999 at 06:17:22PM +0200

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




  reply	other threads:[~1999-06-16 20:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-09 18:38 Junbiao Zhang
1999-06-14 10:55 ` Sven LUTHER
1999-06-14 16:17   ` Pierre Weis
1999-06-16 13:03     ` luther sven [this message]
1999-06-16 20:55       ` Pierre Weis
1999-06-17  8:46         ` Sven LUTHER
1999-06-14 10:34 Toby Moth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19990616150347.C6385@steed.u-strasbg.fr \
    --to=luther@steed.u-strasbg.fr \
    --cc=Pierre.Weis@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=luther@dpt-info.u-strasbg.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox