From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id BACB4BB84 for ; Mon, 24 Nov 2008 23:43:46 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjABAMO8KknU4368lGdsb2JhbACTXgEBAQEJCwgJEQO9SoJ8 X-IronPort-AV: E=Sophos;i="4.33,661,1220220000"; d="scan'208";a="17562158" Received: from moutng.kundenserver.de ([212.227.126.188]) by mail2-smtp-roc.national.inria.fr with ESMTP; 24 Nov 2008 23:43:46 +0100 Received: from [129.199.159.5] (rezo-159-5.ens.fr [129.199.159.5]) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis) id 0MKwtQ-1L4k9i0rvr-0004Sy; Mon, 24 Nov 2008 23:43:46 +0100 Subject: Re: [Caml-list] A function returning itself From: Mathias Kende Reply-To: mathias@kende.fr To: Paolo Donadeo Cc: OCaml mailing list In-Reply-To: <4b5157c30811241437y64d1087au9c50c40f303b2c70@mail.gmail.com> References: <4b5157c30811241437y64d1087au9c50c40f303b2c70@mail.gmail.com> Content-Type: text/plain; charset="UTF-8" Date: Mon, 24 Nov 2008 23:43:30 +0100 Message-Id: <1227566610.6496.165.camel@MATHIAS-ENS> Mime-Version: 1.0 X-Mailer: Evolution 2.24.1 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V01U2FsdGVkX192Fw5IyPSwe4Ukp9nOp1Djt7V9qlbnWzzsyZF /8W6kDhnEKixedWMMq3WI5oYoq7H0gbnBGRqGgmY4hb3/UtztX uG90j85cnNZSk1XtPhnaAts/ScjlhPn X-Spam: no; 0.00; 0100,:01 -rectypes:01 -rectypes:01 mathias:98 mathias:98 rec:01 caml-list:01 constructor:01 int:01 int:01 archives:02 let:03 lundi:05 intermediate:05 definition:07 Le lundi 24 novembre 2008 =C3=A0 23:37 +0100, Paolo Donadeo a =C3=A9crit : > 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 =3D {res: int; f: int -> int -> r} let rec fct a b =3D {res =3D a + b; f =3D fct} Mathias