From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA01897; Fri, 10 Oct 2003 11:18:26 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA29091 for ; Fri, 10 Oct 2003 11:18:25 +0200 (MET DST) Received: from devinci.fr (mail.devinci.fr [194.254.135.15]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h9A9IO102927 for ; Fri, 10 Oct 2003 11:18:24 +0200 (MET DST) Received: from eiffel.devinci.fr (eiffel.devinci.fr [193.107.164.170]) by devinci.fr (8.11.1/jtpda-5.4) with ESMTP id h9A9IOp17811 ; Fri, 10 Oct 2003 11:18:24 +0200 Received: from lulu.devinci.fr (lulu.devinci.fr [193.107.164.162]) by eiffel.devinci.fr (8.9.1b+Sun/jtpda-5.3.2) with ESMTP id LAA18855 ; Fri, 10 Oct 2003 11:18:23 +0200 (MET DST) Subject: Re: [Caml-list] extending a type with Marshal From: Christian Rinderknecht To: Ker Lutyn Cc: caml-list@inria.fr In-Reply-To: <20031008212257.19628.qmail@web40606.mail.yahoo.com> References: <20031008212257.19628.qmail@web40606.mail.yahoo.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-10) Date: 10 Oct 2003 11:19:16 +0200 Message-Id: <1065777556.21150.15.camel@lulu.devinci.fr> Mime-Version: 1.0 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 rinderknecht:01 rinderknecht:01 foo:01 foo:01 interprets:01 interprets:01 subtyping:01 versioning:01 relaying:99 ber:99 decoding:01 ber:99 thesis:01 checker:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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