From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 98A54BC57 for ; Thu, 4 Nov 2010 21:01:51 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlYCABau0kzZSMDje2dsb2JhbACTSo41FQEBCwsKBREFH749hUYEjV2CbQ X-IronPort-AV: E=Sophos;i="4.58,297,1286143200"; d="scan'208";a="64950217" Received: from fmmailgate02.web.de ([217.72.192.227]) by mail3-smtp-sop.national.inria.fr with ESMTP; 04 Nov 2010 21:01:50 +0100 Received: from smtp05.web.de ( [172.20.4.166]) by fmmailgate02.web.de (Postfix) with ESMTP id 5718E17DE6300; Thu, 4 Nov 2010 21:01:50 +0100 (CET) Received: from [78.43.204.177] (helo=frosties.localdomain) by smtp05.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #24) id 1PE60M-0006QH-00; Thu, 04 Nov 2010 21:01:50 +0100 Received: from mrvn by frosties.localdomain with local (Exim 4.72) (envelope-from ) id 1PE60L-000231-LR; Thu, 04 Nov 2010 21:01:49 +0100 From: Goswin von Brederlow To: Dario Teixeira Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Merging object signatures References: <313968.60910.qm@web111509.mail.gq1.yahoo.com> Date: Thu, 04 Nov 2010 21:01:49 +0100 In-Reply-To: <313968.60910.qm@web111509.mail.gq1.yahoo.com> (Dario Teixeira's message of "Thu, 4 Nov 2010 11:55:47 -0700 (PDT)") Message-ID: <87k4ksdfiq.fsf@frosties.localdomain> User-Agent: Gnus/5.110009 (No Gnus v0.9) XEmacs/21.4.22 (linux, no MULE) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: goswin-v-b@web.de X-Sender: goswin-v-b@web.de X-Provags-ID: V01U2FsdGVkX1+E0DCH84c34b3/riPXnNh1ET5mYH/OUUgZJZfE 3HXV/a8qPXfeqX42nukFXsfxqlAqcaZLkY0tSE+nCIEHcudlYI i1kHCoIxU= X-Spam: no; 0.00; merging:01 variants:01 'val:01 foobar:01 foo:01 foo:01 sig:01 val:01 foobar:01 val:01 struct:01 mfg:98 polymorphic:01 signatures:01 signatures:01 Dario Teixeira writes: > Hi, > > Similarly to polymorphic variants, is there a way for object signatures to > be merged by type name? Consider the example at the end; I'm wondering if > it is possible for the declaration of 'foobar' to be something along the > lines of 'val foobar: int -> int -> < foo_t; bar_t >' instead of needing to > explicitly list all the methods in foo_t and bar_t. > > Thanks in advance for your help! > Best regards, > Dario Teixeira > > > module Test: > sig > type foo_t = < a: int > > type bar_t = < b: int > > > val foobar: int -> int -> < a:int; b: int > > > (* val foobar: int -> int -> < foo_t; bar_t > *) > end = > struct > type foo_t = < a: int > > type bar_t = < b: int > > > class foo a = object method a: int = a end > class bar b = object method b: int = b end > > let foobar a b = > object > inherit foo a > inherit bar b > end > end Can't you make foo_t and bar_t class types and foobar_t inherits them both? MfG Goswin