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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id D0A877EE51 for ; Thu, 4 Apr 2013 10:37:38 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of anthony.tavener@gmail.com) identity=pra; client-ip=74.125.83.52; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="anthony.tavener@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of anthony.tavener@gmail.com designates 74.125.83.52 as permitted sender) identity=mailfrom; client-ip=74.125.83.52; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="anthony.tavener@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ee0-f52.google.com) identity=helo; client-ip=74.125.83.52; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="postmaster@mail-ee0-f52.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AikCAGY7XVFKfVM0k2dsb2JhbABDgzy4UwGIMngIFg4BAQEBBwsLCRQEJIIfAQEEAUABGx0BAwELBgUEBw0uIQEBEQEFARwGExuHZgEDCQYMohaML4J7hDwKGScNWYh8AQUMjDuCUgeDQAOIeowRgWCBH4pRAoM3FimETR0 X-IPAS-Result: AikCAGY7XVFKfVM0k2dsb2JhbABDgzy4UwGIMngIFg4BAQEBBwsLCRQEJIIfAQEEAUABGx0BAwELBgUEBw0uIQEBEQEFARwGExuHZgEDCQYMohaML4J7hDwKGScNWYh8AQUMjDuCUgeDQAOIeowRgWCBH4pRAoM3FimETR0 X-IronPort-AV: E=Sophos;i="4.87,407,1363129200"; d="scan'208";a="9739438" Received: from mail-ee0-f52.google.com ([74.125.83.52]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 04 Apr 2013 10:37:38 +0200 Received: by mail-ee0-f52.google.com with SMTP id d17so918257eek.11 for ; Thu, 04 Apr 2013 01:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=Ol2S2qGPEm2oluQWM4iMZzZyaZgFpgBRMzVkIEWU1j0=; b=P2UopyuY5CGFC3fnP2VyubDleLD/XTlLzsua85A3iM07k4l3ZoErkwGiEtf2d2LP82 Oh8TLAA2pHdw7szhv4RWhAJ8NfQPOnbYYzgRuwzadEKnlQgUrBpGo0IZSG8q6q3tbQVq cdM7InqFIZ0YKyRtGPutUwhb69wd8tIdtMFXoiRcQhQnJSp5slogHw8hNhwW92Z/r6nZ gCS9/iJkFr5TFnsjURh+M3TJNb5eHXojNXXwpqXHRaAEN7Iu0lZtgyRJuL4DdtJ24vT8 /98WrkDTSDffYOCwlV2WpWxSuRtztsnu635osdgm0VY7w9Pfhliql2t1Zmyra/07g3VN xsKA== MIME-Version: 1.0 X-Received: by 10.14.216.2 with SMTP id f2mr9099562eep.44.1365064657393; Thu, 04 Apr 2013 01:37:37 -0700 (PDT) Received: by 10.14.2.198 with HTTP; Thu, 4 Apr 2013 01:37:37 -0700 (PDT) In-Reply-To: References: Date: Thu, 4 Apr 2013 02:37:37 -0600 Message-ID: From: Anthony Tavener To: =?ISO-8859-1?Q?Rapha=EBl_Proust?= Cc: "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=e89a8f22c4db000c4a04d984e29c Subject: Re: [Caml-list] Heterogeneous dictionary --e89a8f22c4db000c4a04d984e29c Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Thank-you for the advice and pointers, folks... Well, the common problem is still the same one I've been struggling with: "creating keys", and having to access them. I can't create keys "type-free" in a common module. As I figured... having " modifier.ml" with a bunch of Key.create will have monomorphic types which can't be resolved since with no usage in that module to make the type concrete. I had a nagging feeling I'd need a "whole-program" compiler... Instead I'd have to create keys in modules where they are used... but then I might have a mess of keys like Wounds.recovery, Combat.resist_pain, ... the problem being that only a fraction of these keys actually make sense being associated to a particular module, and it gets confusing to know which (of several candidates) I decided to stash them into. This was the attraction to polymorphic variants (which I rarely use) -- they give a pre-ordained unique ID based on a simple name... no declaration, and no module prefixing, which seems important to me for this case. Note that I have a "database" of tables with different types (implemented by first-class modules!), and it works great for the bulk of my game-state, but each table is well-populated and heavily used in consistent manner. These modifiers though... they're a bit like ad-hoc message passing, where I can submit any message and anywhere else add a snippet of code to interpret it (not that I have any of that going on, otherwise it might hold the solution!). On Thu, Apr 4, 2013 at 1:38 AM, Rapha=EBl Proust wrot= e: > On Thu, Apr 4, 2013 at 1:45 AM, Anthony Tavener > wrote: > > [=85] > > And yet-another-solution, Ocsigen's Polytable: > http://ocsigen.org/ocsigenserver/api/Polytables > > > Cheers, > -- > ______________ > Rapha=EBl Proust > --e89a8f22c4db000c4a04d984e29c Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
Thank-you for the advice and pointers, folks...=

Well, the common problem is still the same one I= 've been struggling with: "creating keys", and having to acce= ss them.

I can't create keys "type-free" in a com= mon module. As I figured... having "mod= ifier.ml" with a bunch of Key.create will have monomorphic types w= hich can't be resolved since with no usage in that module to make the t= ype concrete. I had a nagging feeling I'd need a "whole-program&qu= ot; compiler...

Instead I'd have to create keys in modu= les where they are used... but then I might have a mess of keys like Wounds= .recovery, Combat.resist_pain, ... the problem being that only a fraction o= f these keys actually make sense being associated to a particular module, a= nd it gets confusing to know which (of several candidates) I decided to sta= sh them into. This was the attraction to polymorphic variants (which I rare= ly use) -- they give a pre-ordained unique ID based on a simple name... no = declaration, and no module prefixing, which seems important to me for this = case.

Note that I have a "database" of = tables with different types (implemented by first-class modules!), and it w= orks great for the bulk of my game-state, but each table is well-populated = and heavily used in consistent manner. These modifiers though... they'r= e a bit like ad-hoc message passing, where I can submit any message and any= where else add a snippet of code to interpret it (not that I have any of th= at going on, otherwise it might hold the solution!).



On Thu, Apr 4, 2013 at 1:38 AM, Rapha=EBl Proust <raphlalo= u@gmail.com> wrote:
On Thu, Apr 4, 2013 at 1:45 AM, Anthony Tave= ner
<anthony.tavener@gmail.com<= /a>> wrote:
> [=85]

And yet-another-solution, Ocsigen's Polytable:
http://ocsigen.org/ocsigenserver/api/Polytables


Cheers,
--
______________
Rapha=EBl Proust

--e89a8f22c4db000c4a04d984e29c--