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ël Proust <raphlalou@gmail.com> wrote:
On Thu, Apr 4, 2013 at 1:45 AM, Anthony Tavener
<anthony.tavener@gmail.com> wrote:
> […]

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


Cheers,
--
______________
Raphaël Proust