[
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: | Mathias Kende <mathias@k...> |
| Subject: | Re: [Caml-list] A function returning itself |
Le lundi 24 novembre 2008 à 23:37 +0100, Paolo Donadeo a écrit :
> Since I don't completely understand the inner implications of
> -rectypes and a quick check in the mailing list archives revealed that
> "rectypes is evil", the question I pose is whether is it possible to
> avoid the -rectypes option in this particular case, possibly with the
> definition of an auxiliary type.
Usually, using an intermediate type with a constructor, you can achieve
such thing. Here, something along the line of this should work :
type r = {res: int; f: int -> int -> r}
let rec fct a b = {res = a + b; f = fct}
Mathias