From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 19D84BBC1 for ; Mon, 3 Mar 2008 10:45:06 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAGpXy0fAXQImh2dsb2JhbACQcQEBAQgKKZoc X-IronPort-AV: E=Sophos;i="4.25,436,1199660400"; d="scan'208";a="8882981" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 03 Mar 2008 10:45:05 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m239j2ox009456 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 3 Mar 2008 10:45:05 +0100 X-IronPort-AV: E=Sophos;i="4.25,436,1199660400"; d="scan'208";a="7928235" Received: from arvin.irisa.fr (HELO [131.254.11.86]) ([131.254.11.86]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Mar 2008 10:45:05 +0100 Message-ID: <47CBC7AB.9000601@free.fr> Date: Mon, 03 Mar 2008 10:40:59 +0100 From: "Tiphaine.Turpin" User-Agent: Thunderbird 1.5.0.10 (X11/20070303) MIME-Version: 1.0 To: Keiko Nakata Cc: caml-list@inria.fr Subject: Re: [Caml-list] OO programming References: <20080227.103733.43387508.garrigue@math.nagoya-u.ac.jp> <20080228.173429.68546494.keiko@kurims.kyoto-u.ac.jp> <47C81829.4010505@free.fr> <20080301.005807.125113032.keiko@kurims.kyoto-u.ac.jp> In-Reply-To: <20080301.005807.125113032.keiko@kurims.kyoto-u.ac.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Miltered: at discorde with ID 47CBC89E.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; functors:01 recursive:01 functors:01 camlp:01 syntax:01 camlp:01 jacques's:01 verbose:01 parametric:01 variants:01 variants:01 beginner's:01 ocaml:01 bug:01 duplications:98 Keiko Nakata a écrit : >>> Since there are some people (including me) >>> who are interested in using functors and recursive modules >>> in the style of object-oriented context, >>> >>> >> Do you mean including classes in functors, as Jacques Garrigue >> described, or using modules like classes ? >> > > The former; to include classes in functors. > > >>> I thought that it could be useful to devise >>> a (camlp4) syntax extension which mitigates this a bit painful verbosity. >>> >> camlp4 extensions may help. I already used some for objects (related to >> initializers), and I plan to investigate it further, possibly borrowing >> code from Jacques Garrigue. In the context of functors, the problem is >> that a lot of code would probably remain specific and still need to be >> written by hand, for example, the row types for classes... >> > > As I see Jacques's code, he gradually extends the module type S > to S' and S''. Type declarations in module types and type definitions > in structures involving types event, observer and subject are duplicated > everywhere with slight modifications. > Why can we not extend the previously defined module type > in a less verbose way? > I agree. Maybe the idea of using parametric class type definitions (in WRichT) and defining unparameterized types afterwards (in S'') could be helpfull, as such definitions can be extended with the "inherit " construct. Otherwise you would need to keep syntaxically the successive declarations with camlp4 for future use, which is not very handy. I don't know if there is an equivalent to inherit for polymorphic variants: "type t' = private [> t | ...] doesn't seem to work. And using objects to encode variants is possible, but you may be used to more serious solutions... Tiphaine Turpin > We may still need to write row types by hand. > But I think we should (ideally) do it in a extensible way without duplications. > > With best regards, > Keiko > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >