caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Max Skaller <skaller@ozemail.com.au>
To: John Prevost <jmp@arsdigita.com>
Cc: Mattias Waldau <mattias.waldau@tacton.se>,
	Caml-List <caml-list@inria.fr>
Subject: Re: "pointers" to methods
Date: Fri, 09 Feb 2001 04:00:43 +1100	[thread overview]
Message-ID: <3A82D0BB.DC0D8AA3@ozemail.com.au> (raw)
In-Reply-To: <87n1by3z9i.fsf@elbereth.pgh.arsdigita.com>

John Prevost wrote:

>   let call_method =
>     if Random.int 2 = 0 then
>       fun x -> x #inc
>     else
>       fun x -> x #dec
>   in
>   let obj = new class1 in
>   call_method obj 2;
>   obj #get ()
> 
> You can't reference a method name explicitly, but you can create a
> function that calls that method.

	Oh! This is a beautiful demonstration of the power of
the Ocaml language. Now I will add something: this construction
is MORE powerful than C++ pointers to members, which do not
form an algbraically complete system because they cannot be
composed. But the ocaml ones can be!

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net



  reply	other threads:[~2001-02-08 19:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-06 17:26 Mattias Waldau
2001-02-07 22:27 ` John Prevost
2001-02-08 17:00   ` John Max Skaller [this message]
2001-02-07 23:23 ` Gerd Stolpmann

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=3A82D0BB.DC0D8AA3@ozemail.com.au \
    --to=skaller@ozemail.com.au \
    --cc=caml-list@inria.fr \
    --cc=jmp@arsdigita.com \
    --cc=mattias.waldau@tacton.se \
    /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;
as well as URLs for NNTP newsgroup(s).