Browse thread
[Caml-list] extending a type with Marshal
-
Ker Lutyn
- Richard Jones
- Peter Jolly
- skaller
- Christian Rinderknecht
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Christian Rinderknecht <christian.rinderknecht@d...> |
| Subject: | Re: [Caml-list] extending a type with Marshal |
Hello Ker, On Wed, 2003-10-08 at 23:22, Ker Lutyn wrote: > [...] > In other words, Foo sends message A to Bar. We'd like to be able to > handle two possibilities: > > (1) Foo sends message A' to Bar, who interprets it as A. > (2) Foo sends message A to Bar, who interprets it as A'. > > ...where A' is an extension of A. > > To do this it would be necessary to 'extend' a type at one end [...] This kind of concept is already present (subtyping, versioning, relaying) in a specification language called Abstract Syntax Notation One (ASN.1), and, at least, easily supported by one of its encoding rule called Basic Encoding Rule (BER). The point of ASN.1 is sharing the same ASN.1 module between the two possibly hetereogeneous peers, also agreeing on an encoding/decoding scheme (e.g. BER) and then each peer compile the ASN.1 module into type definitions and codecs in his application language (obviously, you seems interested in O'Caml). Then compile and link. In my PhD thesis I wrote a parser and a checker for ASN.1:1988/90, but no code generation for O'Caml. I remember that Erlang had such a facility integrated transparently. It is worth looking this way. For all information about ASN.1, see the excellent site of France Telecom R&D at http://asn1.elibel.tm.fr/. By the way, these folks develop some ASN.1 tools in O'Caml, but do not disclose their source code in general. Hope this helps, Christian -- --------------------------------------------------------------------------- Christian Rinderknecht Phone: +33 1 41 16 70 39 Assistant Professor Fax: +33 1 41 16 71 71 D.E.R. Genie Informatique (ESILV) Pole Universitaire Leonard de Vinci F-92916 Paris La Defense Cedex (France) ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners