From: Markus Mottl <mottl@miss.wu-wien.ac.at>
To: David Chemouil <David.Chemouil@enseeiht.fr>
Cc: caml-list@inria.fr
Subject: Re: polymorphic variants
Date: Fri, 9 Jun 2000 21:04:59 +0200 [thread overview]
Message-ID: <20000609210458.A29376@miss.wu-wien.ac.at> (raw)
In-Reply-To: <3940B051.BF1136F7@enseeiht.fr>; from David.Chemouil@enseeiht.fr on Fri, Jun 09, 2000 at 10:52:33 +0200
On Fri, 09 Jun 2000, David Chemouil wrote:
> 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.
Maybe you would want to try something like this (uses the Marshal module):
type admin_args = ...
type user_data = string
type argument = MsgA of admin_args * user_data | MsgB of ... | ...
Then you can react to messages as follows, for example:
let recv = function
| MsgA (adm_args, user_data) ->
handle_adm_args adm_args;
call_user_program (Marshal.from_string user_data)
| MsgB ... ->
...
Sending would be something like:
let send user_data =
let adm_args = create_args ()
and contents = Marshal.to_string user_data [Closures] in
send_network (MsgA (adm_args, contents))
Very rudimentary, but the basic idea (keep user data encoded in a string
until needed) should be clear...
Best regards,
Markus Mottl
--
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl
next prev parent reply other threads:[~2000-06-12 14:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-06-09 8:52 David Chemouil
2000-06-09 19:04 ` Markus Mottl [this message]
2000-06-09 20:03 ` Markus Mottl
2007-01-16 20:32 Polymorphic Variants Tom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20000609210458.A29376@miss.wu-wien.ac.at \
--to=mottl@miss.wu-wien.ac.at \
--cc=David.Chemouil@enseeiht.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).