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 NAA03181; Wed, 15 Oct 2003 13:34:10 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA22217 for ; Wed, 15 Oct 2003 13:34:09 +0200 (MET DST) Received: from out2.smtp.messagingengine.com (out2.smtp.messagingengine.com [66.111.4.26]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h9FBY8121506 for ; Wed, 15 Oct 2003 13:34:08 +0200 (MET DST) Received: from mail.messagingengine.com (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id B56422EE5B2 for ; Wed, 15 Oct 2003 07:34:06 -0400 (EDT) Received: from 10.202.2.150 ([10.202.2.150] helo=mail.messagingengine.com) by messagingengine.com with SMTP; Wed, 15 Oct 2003 07:34:06 -0400 X-Epoch: 1066217646 X-Sasl-enc: 6ZY7BVuFZlsPt00qw3feuw Received: from [192.168.0.139] (f03m-10-10.d1.club-internet.fr [212.194.57.10]) by mail.messagingengine.com (Postfix) with ESMTP id B6AA52EE5D4 for ; Wed, 15 Oct 2003 07:34:05 -0400 (EDT) Date: Wed, 15 Oct 2003 13:33:51 +0200 (CEST) From: Martin Jambon X-X-Sender: martin@mj.medit.fr To: caml-list@inria.fr Subject: [Caml-list] Pseudo-extensible records Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; mli:01 subtyping:01 hand-written:01 labels:01 marshal:01 float:02 float:02 objects:02 objects:02 jambon:02 jambon:02 module:03 classes:03 types:03 types:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, I was thinking of some way to define record types with "the same fields plus some others": (** point2.mli **) type point2 = { x : float; y : float } (** point3.ml **) type point3 = { include Point2.point2; z : float } (* which would be exactly equivalent as writing *) type point3 = { x : float; y : float; z : float } Some disavantadges: - same field labels but no subtyping (and all the usual problems that we don't have with classes and objects) Some advantages: - can be used where objects cannot (input/output_value are possible) - makes some type definitions more clear My initial problem is to input/output objects with a minimum of efforts. If we have one module for each class, with some hand-written conversion from/to record types, maybe it would be convenient to have a such a pseudo-inheritance system for record types. Any experience with this kind of problem? Unless Marshal becomes available for objects?... -- Martin ------------------- 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