polymorphic variants

From: David Chemouil (David.Chemouil@enseeiht.fr)
Date: Fri Jun 09 2000 - 10:52:33 MET DST

  • Next message: David Chemouil: "Obj.magic"

    Hi,

    I and my teammates are currently writing a compiler for a distributed
    language, called ML-Act, that generates OCaml 3.00 code. I'm involved in
    the code generation and middleware design.

    The middleware is made of servers which are, of course, intended to work
    with many different applications.

    Each application is likely to send messages through the network. We only
    find the type of an argument when compiling an ML-Act program.

    The problem is that, as server communicate for admistrative reasons,
    they exchange messages with arguments of which I already know the type
    constructor.

    As a consequence, the servers must manipulate a type 'argument' which is
    not yet completely defined: the part interesting the servers is defined
    but not the one interesting the generated OCaml program.

    Therefore, the server programs could not be linked, because the type
    'argument' can't be created as long as I don't know all the type
    constructors. So, these server programs should be compiled for a
    specific application, for which I would have found all possible
    constructors for an argument.

    The solution I found is the following one: I use polymorphic variants.
    Then, the servers use polymorphic constructors, and can be compiled.
    And for each compiled ML-Act application, I generate a type 'argument'
    containing, as constructors, the server constructors, plus the
    constructors found at compilation.

    However, I wonder if my solution is really good, from a software
    engineering point of view. Or, on the contrary, is it a good example of
    why polymorphic variants can be interested. In fact, I wonder how I
    could have done without this new possibility in OCaml 3.00.

    -- 
    David Chemouil [mailto:chemouil@enseeiht.fr] [mobile: 06 84 16 26 65]
    

    Laboratoire d'informatique et de mathématiques appliquées (IRIT-INPT)

    "Je vous ai fait trop faibles pour sortir du gouffre, parce que je vous ai fait assez forts pour n'y point tomber" -- Rousseau



    This archive was generated by hypermail 2b29 : Fri Jun 09 2000 - 19:37:12 MET DST