Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* polymorphic variants
@ 2000-06-09  8:52 David Chemouil
  2000-06-09 19:04 ` Markus Mottl
  2000-06-09 20:03 ` Markus Mottl
  0 siblings, 2 replies; 4+ messages in thread
From: David Chemouil @ 2000-06-09  8:52 UTC (permalink / raw)
  To: caml-list



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




^ permalink raw reply	[flat|nested] 4+ messages in thread
* Polymorphic Variants
@ 2007-01-16 20:32 Tom
  0 siblings, 0 replies; 4+ messages in thread
From: Tom @ 2007-01-16 20:32 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

I have a question... I hope it will not be dismissed right away, thou I
guess most of you will find it stupid (some might however agree with me...
hopefully).

Cut the crap!

So... why actually are polymorphic variants useful? Why can't they simply be
implemented as normal, concrete (or how would you call them? ...) variants?
Doesn't the use of polymorphic variants just mess up the function type?

I'm not orthogonally against polymorphic variants, it's just that I am
looking for an alternative concept that could be used instead... Maybe
subtyped records?

- Tom

[-- Attachment #2: Type: text/html, Size: 614 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-01-16 20:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-09  8:52 polymorphic variants David Chemouil
2000-06-09 19:04 ` Markus Mottl
2000-06-09 20:03 ` Markus Mottl
2007-01-16 20:32 Polymorphic Variants Tom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox