[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Max Skaller <skaller@o...> |
| Subject: | Re: "pointers" to methods |
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