Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Sven LUTHER <luther@maxime.u-strasbg.fr>
To: Pierre Weis <Pierre.Weis@inria.fr>,
	luther sven <luther@steed.u-strasbg.fr>
Cc: caml-list@inria.fr, luther@dpt-info.u-strasbg.fr
Subject: Re: forward function definitions
Date: Thu, 17 Jun 1999 10:46:13 +0200	[thread overview]
Message-ID: <19990617104613.A29113@maxime.u-strasbg.fr> (raw)
In-Reply-To: <199906162055.WAA22149@pauillac.inria.fr>; from Pierre Weis on Wed, Jun 16, 1999 at 10:55:31PM +0200

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




  reply	other threads:[~1999-06-17 15:47 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
1999-06-16 20:55       ` Pierre Weis
1999-06-17  8:46         ` Sven LUTHER [this message]
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=19990617104613.A29113@maxime.u-strasbg.fr \
    --to=luther@maxime.u-strasbg.fr \
    --cc=Pierre.Weis@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=luther@dpt-info.u-strasbg.fr \
    --cc=luther@steed.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