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=1.2 required=5.0 tests=AWL,SPF_NEUTRAL 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 5126EBBCA for ; Thu, 28 Feb 2008 17:02:40 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJFpxkfAXQInh2dsb2JhbACQcQEBAQgKKZUjh1M X-IronPort-AV: E=Sophos;i="4.25,419,1199660400"; d="scan'208";a="23169139" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 28 Feb 2008 17:02:39 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m1SG2apq001675 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 28 Feb 2008 17:02:39 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAMxpxkfY7zq/imdsb2JhbACQcQEBAQgEBRIYlSOHUw X-IronPort-AV: E=Sophos;i="4.25,419,1199660400"; d="scan'208";a="9712623" Received: from gv-out-0910.google.com ([216.239.58.191]) by mail3-smtp-sop.national.inria.fr with ESMTP; 28 Feb 2008 17:02:39 +0100 Received: by gv-out-0910.google.com with SMTP id i36so1082906gve.28 for ; Thu, 28 Feb 2008 08:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; bh=u4l/LsTSEiBnFJ8WiFAzyffLW1xavvH8PPteaiP6ngg=; b=dIXi5bFYJ33b5nRdgq+VTqVvRL9AQ1YLYFkhwWmMOcPrqV2bBMDPEQkNfxkW5UgvVnhO4h3TFY6lP8sDXqR+tk7cxB3L7b5JYT2vKJ/dC20nWKQ4t6tpex8SofnTOhI2VvHCRjX2R2bdKcENaxsZpbn18M6ty5JyL7xzWuiY5Oc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=gEbMLmp8sjKC2Zlz5sqJzuKWNu88S5uJ7p+gM1gnWvaiY53i3/pKLK1/uL2+VJ3cNTML3zP1VZtQWxyUIvyZ33opKmt+TbVTCNMH9YSk7dlTIZ9XZSYL5e9XZ+mqliU7nKrAGXPDhisEtwqPu2sOK+HD17eSnmTLXgAw9gLFi7k= Received: by 10.114.181.1 with SMTP id d1mr9594398waf.10.1204214556531; Thu, 28 Feb 2008 08:02:36 -0800 (PST) Received: from ?192.168.0.16? ( [70.243.137.37]) by mx.google.com with ESMTPS id a42sm13123979rne.11.2008.02.28.08.02.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 28 Feb 2008 08:02:28 -0800 (PST) Message-ID: <47C6DAFD.6000208@gmail.com> Date: Thu, 28 Feb 2008 10:02:05 -0600 From: Edgar Friendly User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: Andrej.Bauer@andrej.com Cc: 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> <47C6B774.8070308@fmf.uni-lj.si> In-Reply-To: <47C6B774.8070308@fmf.uni-lj.si> Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 47C6DB1C.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; andrej:01 functors:01 functors:01 recursive:01 camlp:01 syntax:01 syntax:01 encodings:01 functor:01 struct:01 sig:01 struct:01 polymorphism:01 val:01 sig:01 Andrej Bauer wrote: > 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) > I wonder what use you would put this to where normal 'a polymorphism wouldn't suffice. > 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 > Similarly, an additional parameter on each of the contained functions seems not too unreasonable. I guess I can see more use for this than #1, but a global ref inside F might also work, as long as you had a way to set it and you had a good default. E.