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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 22A61BBCA for ; Thu, 28 Feb 2008 14:30:33 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAGJGxkfAXQImh2dsb2JhbACQcQEBAQgKKZx6 X-IronPort-AV: E=Sophos;i="4.25,419,1199660400"; d="scan'208";a="23161190" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 28 Feb 2008 14:30:33 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m1SDUUi1026944 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 28 Feb 2008 14:30:32 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CACdGxkfBAkMtfGdsb2JhbACQcQEBCQQGKZx4 X-IronPort-AV: E=Sophos;i="4.25,419,1199660400"; d="scan'208";a="8719487" Received: from vega.fmf.uni-lj.si (HELO postar.fmf.uni-lj.si) ([193.2.67.45]) by mail1-smtp-roc.national.inria.fr with ESMTP; 28 Feb 2008 14:30:30 +0100 Received: from localhost (unknown [192.168.5.1]) by postar.fmf.uni-lj.si (Postfix) with ESMTP id 5A41C378600 for ; Thu, 28 Feb 2008 14:30:29 +0100 (CET) X-Virus-Scanned: amavisd-new at spam.fmf.uni-lj.si Received: from postar.fmf.uni-lj.si ([192.168.5.5]) by localhost (spam.fmf.uni-lj.si [192.168.5.1]) (amavisd-new, port 10024) with ESMTP id ElgRy+u7E-UD for ; Thu, 28 Feb 2008 14:30:29 +0100 (CET) Received: from [193.2.67.88] (unknown [193.2.67.88]) by postar.fmf.uni-lj.si (Postfix) with ESMTP id D2C9A378560 for ; Thu, 28 Feb 2008 14:30:28 +0100 (CET) Message-ID: <47C6B774.8070308@fmf.uni-lj.si> Date: Thu, 28 Feb 2008 14:30:28 +0100 From: Andrej Bauer Reply-To: Andrej.Bauer@andrej.com User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: Caml Subject: Re: [Caml-list] OO programming References: <20080226.151750.16504093.garrigue@math.nagoya-u.ac.jp> <47C4AE08.5000604@free.fr> <20080227.103733.43387508.garrigue@math.nagoya-u.ac.jp> <20080228.173429.68546494.keiko@kurims.kyoto-u.ac.jp> In-Reply-To: <20080228.173429.68546494.keiko@kurims.kyoto-u.ac.jp> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 47C6B776.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; andrej:01 andrej:01 functors:01 functors:01 recursive:01 camlp:01 syntax:01 syntax:01 encodings:01 functor:01 struct:01 sig:01 struct:01 val:01 sig:01 Keiko Nakata wrote: >>> As for extension, I'm fully satisfied. But the verbosity level is >>> annoying for scalability... >> Well, yes, that's always the problem with functors... > > Since there are some people (including me) > who are interested in using functors and recursive modules > in the style of object-oriented context, > I thought that it could be useful to devise > a (camlp4) syntax extension which mitigates this a bit painful verbosity. > > At the moment, I have no idea which syntax is general enough and intuitive for us, > but as far as I understand we always follow similar encodings. I have three wishes related to the case when a functor accepts a structure that contains a single type or a single value: 1) To be able to write module F(type t) = struct ...t... end instead of module F(T : sig type t end) = struct ... T.t ... end and to write F(s) instead of F(struct type t = s end) 2) Similarly for values, to be able to write module F(val x : t) = struct ... x ... end instead of module F(T : sig val x : t end) = struct ... T.x ... end 3) Similarly for signatures: module type F = functor type t -> sig ... end module type F = functor val x : t -> sig ... end I believe these are campl4 trivialities. There may be some hoxus-pocus related to generating suitable names for T's above. Andrej