From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr 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 D91857EE4B for ; Fri, 27 Sep 2013 17:38:08 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of yotambarnoy@gmail.com) identity=pra; client-ip=209.85.216.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="yotambarnoy@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of yotambarnoy@gmail.com designates 209.85.216.170 as permitted sender) identity=mailfrom; client-ip=209.85.216.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="yotambarnoy@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qc0-f170.google.com) identity=helo; client-ip=209.85.216.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="postmaster@mail-qc0-f170.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0CAHmlRVLRVdiqm2dsb2JhbABahBHAS4EUCBYOAQEBAQEGCwsJFCiCJQEBBAFAARsdAQMMBgUEBzshAQERAQUBHAYTh3MBAwkGnAiMUoMKhAsKGScNZIkAAQUMjFqBLYE+B4QgA5YWgWmMRINKGCmEaSCBLQ X-IPAS-Result: Ai0CAHmlRVLRVdiqm2dsb2JhbABahBHAS4EUCBYOAQEBAQEGCwsJFCiCJQEBBAFAARsdAQMMBgUEBzshAQERAQUBHAYTh3MBAwkGnAiMUoMKhAsKGScNZIkAAQUMjFqBLYE+B4QgA5YWgWmMRINKGCmEaSCBLQ X-IronPort-AV: E=Sophos;i="4.90,994,1371074400"; d="scan'208";a="34649852" Received: from mail-qc0-f170.google.com ([209.85.216.170]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 27 Sep 2013 17:38:02 +0200 Received: by mail-qc0-f170.google.com with SMTP id m20so1862806qcx.1 for ; Fri, 27 Sep 2013 08:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=xdlPOMJTXC+qFY0RZ1qh/JTp/zlFEY90xsxYA43CraU=; b=nQRd/Of9sNyO4+2fRSuyHFaS0ro8PpxPeNXURZo5rvjinQTeZHUs220Xbczv+nFzvk hgt4RftwcJYc+U1RmUpOxhfQpwro3FVfOhL7UJA35Xoi/puDU/NBvSnPpU5KzT+A4nOt i7HvU9HO4sFH36CuCUqWIOOQG4ldbOWLQLFLWmnrsPQZEH8cZoqK5wPjhWBVhRUpkMPf e8hOwNHeQdfWOfhW5re85OIOwopQeGav3ndWHMYl+z2+3bU9kWrzTymwE2QE5nJx6LF/ VD3MXsVS4aQh9rjD0A0Y2hr2A5sGx2jivYIj3lPtJgkcuxsGuxbnnkR11xW4XOEx7WMk vB8A== X-Received: by 10.49.131.132 with SMTP id om4mr9939356qeb.2.1380296282323; Fri, 27 Sep 2013 08:38:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.139.20 with HTTP; Fri, 27 Sep 2013 08:37:42 -0700 (PDT) In-Reply-To: References: From: Yotam Barnoy Date: Fri, 27 Sep 2013 11:37:42 -0400 Message-ID: To: Anthony Tavener Cc: Dmitry Grebeniuk , Yotam Barnoy Content-Type: multipart/alternative; boundary=047d7beb9a4697c57904e75f45b7 Subject: Re: [Caml-list] Proposal: re-design of ocaml headers --047d7beb9a4697c57904e75f45b7 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Sep 27, 2013 at 11:31 AM, Anthony Tavener wrote: > > On Fri, Sep 27, 2013 at 9:08 AM, Dmitry Grebeniuk wrote: > >> >> Why will anyone ever need more than 200 constructors of a sum type? >> (also note the presence of polymorphic variant types.) >> >> > Back when I read about the limit on constructors I had a moment of worry. > Thankfully the limit is only on non-constant constructors. > > I currently have a variant with 292 constructors, but only 30 are > non-constant. > These represent optional characteristics a character may have in a game, > some > with additional payload. I could imagine all of them having their own > payload, > but of course there are other options, like polymorphic variants, or > encoding these > purely as data rather than types. > > I wanted to share that as a "be careful of what seems impossible from your > perspective". ;) > Right. Constant constructors are represented as integers and require no header, so they're very cheap. And polymorphic variants use more memory, so they're not a great option. Having the flexibility for more constructors is a good thing. Yotam --047d7beb9a4697c57904e75f45b7 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On F= ri, Sep 27, 2013 at 11:31 AM, Anthony Tavener <anthony.tavener@gma= il.com> wrote:

On Fri, Sep 27, 2013 at 9:= 08 AM, Dmitry Grebeniuk <gdsfh1@gmail.com> wrote:

=A0 Why will anyone ever need more than 200 constructors of a sum type?
(also note the presence of polymorphic variant types.)


Back when I read abou= t the limit on constructors I had a moment of worry.
Thankfully t= he limit is only on non-constant constructors.

I currently have a variant with 292 constructors, but only 3= 0 are non-constant.
These represent optional characteristics a ch= aracter may have in a game, some
with additional payload. I could= imagine all of them having their own payload,
but of course there are other options, like polymorphic variants, or e= ncoding these
purely as data rather than types.

I wanted to share that as a "be careful of what seems impossib= le from your
perspective". ;)=A0

Right. Constant con= structors are represented as integers and require no header, so they're= very cheap. And polymorphic variants use more memory, so they're not a= great option. Having the flexibility for more constructors is a good thing= .

Yotam

--047d7beb9a4697c57904e75f45b7--