From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id 6FB445D4 for ; Fri, 13 Jul 2018 11:10:08 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.51,347,1526335200"; d="scan'208,217";a="338774664" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 13 Jul 2018 13:10:06 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 6BEB4824B5; Fri, 13 Jul 2018 13:10:06 +0200 (CEST) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 2884D81792 for ; Fri, 13 Jul 2018 13:10:01 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=angelo@icorsaro.net; spf=None smtp.mailfrom=angelo@icorsaro.net; spf=None smtp.helo=postmaster@mail-wr1-f47.google.com IronPort-PHdr: =?us-ascii?q?9a23=3AI3leixLXblvpX9d9TNmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgRKPnxwZ3uMQTl6Ol3ixeRBMOHs6wC07KempujcFRI2YyGvnEGfc4EfD4+ou?= =?us-ascii?q?JSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgpp?= =?us-ascii?q?POT1HZPZg9iq2+yo9JDffwRFiCChbb9uMR67sRjfus4KjIV4N60/0AHJonxGe+?= =?us-ascii?q?RXwWNnO1eelAvi68mz4ZBu7T1et+ou+MBcX6r6eb84TaFDAzQ9L281/szrugLd?= =?us-ascii?q?QgaJ+3ART38ZkhtMAwjC8RH6QpL8uTb0u+ZhxCWXO9D9QLYpUjqg8qhrUgflhi?= =?us-ascii?q?cbODE27W/ZicJ+grxcrh+6vRNz34vUbZuVNPZifK7Qe84RS2pbXsZWUixMGp+x?= =?us-ascii?q?b40AD+UfOeZYqJT2qkUJrRukHgmjHvnvyjhVjXLxx6I61eshHh/C3AwnBN8OsW?= =?us-ascii?q?jbrNLvNKcJS++11q7IwS/Fb/xIxTfw8Y7FeQ0ir/GURb98b9bdxE01Gw7Gjlic?= =?us-ascii?q?s5LpMy2I2ugXvGWW7fJsWOGuhmI9tQ18rTmiyt0xhoTIiY8Z0E7I+ThnzIszON?= =?us-ascii?q?a2UlR0YcS+H5tVryyaN5V5QsclQ2xwvSY10LwGuZqicCkE0pQr2gfTa/KIfoWK?= =?us-ascii?q?+B7jW+GRITB3hHJhZr2znQq98U+lyuHkV8m01khFrjZdn9XSqnwA0wbf58uHR/?= =?us-ascii?q?dn4EutxyuD2xrc5+xGOUw0kLDUK58lwr4+jJoTtkHDEzfsl0Xwg6+ZaEEk+u+z?= =?us-ascii?q?5uTmfrrmoYWcN5RuhQHkNaQigMq/DvokMgQWRWiU5fy81KH//U3+WLhFkuc5kq?= =?us-ascii?q?zdsJzDIcQbp7W5AxNO34Y46xe/Ci+m384CkXkGKlJFYhOHgJLzN1HAOvCrRcu4?= =?us-ascii?q?1l+llTMuw/HdIpXgBI/MJz7NiuTPZ7F4vmdaxwc3yph04IhPA6sGaKb6XED8sN?= =?us-ascii?q?vwDxQ+KRe92eGhDthhgNBNEVmTC7OUZfuB+WSD4fgidrHVNd0l/Q3lIv1g3MbA?= =?us-ascii?q?yHowmFsTZ66shMdFaXu/BO9vOULfZ3fw0I9YTTU6+zEmRemvs2WsFCZJbi/uDa?= =?us-ascii?q?M34SsgAZihS4HOWtL12eHT7GKABpRTI1t+JBWMHHPvLdjWXv4NbGeNOJYknGBb?= =?us-ascii?q?E7emTIAl2Felswqok7c=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AnAgD+h0hbfy/dVdFcHQEBBQELAYVTg?= =?us-ascii?q?3uIY4takjOFIoEQA1MLLIcRGQYGNBQBAgEBAgEBAQEBEwEBCQsLCCclDII1IoM?= =?us-ascii?q?JHQEBOBg2DgI2AQUBAoNTggAEjXmQAjyKG26BLoJxAQEFgWOFWwgJAQiIcIIWg?= =?us-ascii?q?TiCaoRDgzkxgiSZWwmPNVaHJoVXjzqCMwIEAgQFAgUPIYE3gXMzGggmCmUBgj4?= =?us-ascii?q?+gVuDaIpUbQFtCxuLAAEB?= X-IPAS-Result: =?us-ascii?q?A0AnAgD+h0hbfy/dVdFcHQEBBQELAYVTg3uIY4takjOFIoE?= =?us-ascii?q?QA1MLLIcRGQYGNBQBAgEBAgEBAQEBEwEBCQsLCCclDII1IoMJHQEBOBg2DgI2A?= =?us-ascii?q?QUBAoNTggAEjXmQAjyKG26BLoJxAQEFgWOFWwgJAQiIcIIWgTiCaoRDgzkxgiS?= =?us-ascii?q?ZWwmPNVaHJoVXjzqCMwIEAgQFAgUPIYE3gXMzGggmCmUBgj4+gVuDaIpUbQFtC?= =?us-ascii?q?xuLAAEB?= X-IronPort-AV: E=Sophos;i="5.51,347,1526335200"; d="scan'208,217";a="338774644" Received: from mail-wr1-f47.google.com ([209.85.221.47]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 13 Jul 2018 13:09:59 +0200 Received: by mail-wr1-f47.google.com with SMTP id a3-v6so15501752wrt.2 for ; Fri, 13 Jul 2018 04:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icorsaro-net.20150623.gappssmtp.com; s=20150623; h=from:mime-version:subject:message-id:date:to; bh=mj61p89AEUFFrrUG4AFIvFIT9YzQOEB4RBhHAbDA2yg=; b=sI3IKkcMBwKLTB3/POxKNOKgrO9DXyAmvAW+PVaVQ/16MjoU1rbePA4yZA9VJwszSW 7CFKNiVA8F0FWwgFqgMmPqhByNDrxHKXwSSGfJY11RgAO+is2yE4sQpw3bQVEGRI4XDc 3yOUzWvr83MEhYcat9UDLnCXHFc1by8CrWZL2JHshawkB0cH+JcFdwRVa69SlDvKY9n8 iTHr24wv5kg7nE9XYcvKifhFKGUULLBanCoq/YlEI9D+mCHriIpeHhxXVT1+F/m6ET7f SiWaMydeWj/PTv3QODY0i4oLJH9RHNLzkshXI0cC+39ncnlMXN8eG8CTavjUhNaoQJS8 whRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=mj61p89AEUFFrrUG4AFIvFIT9YzQOEB4RBhHAbDA2yg=; b=hUEewhciQDJZpMhZMkyUYfqbiUyKc7/u6R5cC/AhGoDxwJr77Th5eWUi57bZMc523A 5CL67+d9SsrFtb3T7GVJSyu0WtUggvoDugVHysEIIVYNN4466IXndXancys3iJzsmOqM ZO/Y0g+x8YM3oIR+/JL5WyRwM8FQ8c9OYLdS5/yHE73Tx2FQ9P/ki7QKvqI3rYegVbHr dNksC8DgDzNhslUDsttn1cbH05Lzomd6z9RgdRHGxhiBwbGpsJc6yTaOJUL4FkCT32Vp gioEpSizq48WxI+l4DvXfHtbv9vBmg2+bko3Th3nKJyl3tnzJsgF5SzGcGTizHmPJqyL 7WNA== X-Gm-Message-State: AOUpUlF+bzXz7zwVLvRid7GYOfpe8LINbUpNYzpFb74mtl82eq5TvQTp Cq7KlWDN4tVxlHPnPw7dkGTStJo69II= X-Google-Smtp-Source: AAOMgpfP/JoWoLxoUF995TfT77zI8zZpK/4eIWIG1gFDWcrdYzcMpY1NV2SjyQZWiiI1ByOK1HhB6Q== X-Received: by 2002:adf:f64c:: with SMTP id x12-v6mr4290507wrp.97.1531480199166; Fri, 13 Jul 2018 04:09:59 -0700 (PDT) Received: from ekam.home (LFbn-1-687-212.w86-246.abo.wanadoo.fr. [86.246.164.212]) by smtp.gmail.com with ESMTPSA id g75-v6sm8580340wmd.38.2018.07.13.04.09.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 04:09:58 -0700 (PDT) From: Angelo Corsaro Content-Type: multipart/alternative; boundary="Apple-Mail=_3AC22C9E-DDF9-40CF-BDD7-CD194341B5C4" Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Message-Id: Date: Fri, 13 Jul 2018 13:09:56 +0200 To: caml-list@inria.fr X-Mailer: Apple Mail (2.3445.8.2) Subject: [Caml-list] Recursive Types and -rectypes Reply-To: Angelo Corsaro X-Loop: caml-list@inria.fr X-Sequence: 16990 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --Apple-Mail=_3AC22C9E-DDF9-40CF-BDD7-CD194341B5C4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Dear All, I am looking for some advices and suggestions on the use of recursive type= s that OCaml makes available through the -rectypes option.=20 To give you some context we have built a simple Agent framework for Ocaml t= hat provides primitives similar to those of Erlang =E2=80=94 with the diffe= rence that at the present time we care only on using actors to control conc= urrency on the same process. As you can probably imagine the recursive type= definition comes out from the actor message queue. The most straight forwa= rd definition would look like (removing some details to keep the essence): type =E2=80=98msg actor_queue =3D ( =E2=80=98msg actor_queue option * =E2= =80=98msg) some_queue_type=20 This is a simplified version, but let=E2=80=99s say that the intuition is t= hat we need to post on the receiving actor queue the message along to possi= bly the queue of the agent we may reply to. This gives rise to a recursive = type definition which clearly would only be usable with the -rectypes optio= n. The traditional way of breaking things kind of recursive types is to use va= riant types recursion. Which is what I=E2=80=99ve done. Yet that comes at s= ome cost w.r.t. the readability of the code. Thus the question, would you s= uggest using -rectypes to enable recursive data types? Use classes to repre= sent this type, as they allow for recursive type definition? Or just stick = with the variant type trick? Thanks very much in advance for sharing your thoughts! Ciao, Angelo P.S. =E2=80=98msg is actually bound with some polymorphic variant to allow = the actor to accept any user defined type as in Erlang. We also have a vers= ion that leverages functors to define the messages that may be exchanged be= tween actors =E2=80=94 if a strict control is required on the set of messag= es exchanged.=20 =E2=80=94 =E2=80=9CSimplicity is the ultimate sophistication." ~ Leonardo da Vinci --=20 Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs= --Apple-Mail=_3AC22C9E-DDF9-40CF-BDD7-CD194341B5C4 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Dear All,
<= br class=3D"">
I am looking for some advices and suggestions on = the use of recursive types that  OCaml makes available through the -re= ctypes option. 

To give you some context we have built a simple Agent framework for O= caml that provides primitives similar to those of Erlang =E2=80=94 with the= difference that at the present time we care only on using actors to contro= l concurrency on the same process. As you can probably imagine the recursiv= e type definition comes out from the actor message queue. The most straight= forward definition would look like (removing some details to keep the esse= nce):

type =E2=80=98msg actor_queue =3D ( =E2=80=98msg actor_queue option * = =E2=80=98msg) some_queue_type 
=
This is a simplified version, but = let=E2=80=99s say that the intuition is that we need to post on the receivi= ng actor queue the message along to possibly the queue of the agent we may = reply to. This gives rise to a recursive type definition which clearly woul= d only be usable with the -rectypes option.

The traditional way of breakin= g things kind of recursive types is to use variant types recursion. Which i= s what I=E2=80=99ve done. Yet that comes at some cost w.r.t. the readabilit= y of the code. Thus the question, would you suggest using -rectypes to enab= le recursive data types? Use classes to represent this type, as they allow = for recursive type definition? Or just stick with the variant type trick?

Thanks very much i= n advance for sharing your thoughts!

Ciao,
    Angelo

P.S. =E2=80=98msg is act= ually bound with some polymorphic variant to allow the actor to accept any = user defined type as in Erlang. We also have a version that leverages funct= ors to define the messages that may be exchanged between actors =E2=80=94 i= f a strict control is required on the set of messages exchanged. 

=E2=80=94
<= /div>
=E2=80=9CSimplicity is the ultimate sophistication." ~ Leonardo da Vinci
<= /div>

= --Apple-Mail=_3AC22C9E-DDF9-40CF-BDD7-CD194341B5C4--