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.4 required=5.0 tests=SPF_NEUTRAL autolearn=disabled version=3.1.3 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 AF86BBC69 for ; Fri, 23 Nov 2007 14:42:09 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAHdnRkfAXQInh2dsb2JhbACPNAEBAQgKKYEP X-IronPort-AV: E=Sophos;i="4.21,456,1188770400"; d="scan'208";a="19608320" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 23 Nov 2007 14:42:09 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id lANDg8SD014980 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 23 Nov 2007 14:42:09 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAHdnRkdA6aLukGdsb2JhbACPNAEBAQEHAgYTEQeBDw X-IronPort-AV: E=Sophos;i="4.21,456,1188770400"; d="scan'208";a="4829484" Received: from nz-out-0506.google.com ([64.233.162.238]) by mail1-smtp-roc.national.inria.fr with ESMTP; 23 Nov 2007 14:42:08 +0100 Received: by nz-out-0506.google.com with SMTP id z3so2382838nzf for ; Fri, 23 Nov 2007 05:42:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:from:reply-to:to:subject:date:user-agent:references:in-reply-to:content-type:content-transfer-encoding:content-disposition:message-id; bh=iW98GNDUe8SnweQqysQMBgojWEC5UFtzopNCWHR5Yxc=; b=TLNjJbJHl5Iakzx0/emx1/GsFzO9IlpMggco1SNPpg+W388zz0GCFWGGhnCh0COOaaIRkCQKVvVZTfnNOitX2o+AYzREyJ0fIsUVPDM0vjFGYicPa1HM20rQBaUwnv2FpjY3UIJcWFkpaT2PVlz5HpcDpzklZi0l6dZ1Tw1Hhg4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:reply-to:to:subject:date:user-agent:references:in-reply-to:content-type:content-transfer-encoding:content-disposition:message-id; b=uFMgfhXuTnGSDEuj1l2mlVsBsAK6GtL1jj3XTF5ISDEiodxI6AXf4mmoDq0lTDH8sOhBuwyhMNcG6xHBTjJLyBwqi8zAW4w3QF+FFiSUl/qdpNkXs6jnfUFZmUxi19ObXQSAZ1l5oap0AA8m8AjT6a6LSmHWcy7P1crSK24WrNM= Received: by 10.143.160.1 with SMTP id m1mr293108wfo.1195825326667; Fri, 23 Nov 2007 05:42:06 -0800 (PST) Received: from tama-chan ( [24.99.180.210]) by mx.google.com with ESMTPS id 61sm3125712wry.2007.11.23.05.42.05 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Nov 2007 05:42:05 -0800 (PST) From: Peng Zang Reply-To: peng.zang@gmail.com To: caml-list@inria.fr Subject: Re: [Caml-list] Adding methods to an object Date: Fri, 23 Nov 2007 08:41:51 -0500 User-Agent: KMail/1.9.7 References: <200711171443.59672.jon@ffconsultancy.com> In-Reply-To: <200711171443.59672.jon@ffconsultancy.com> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200711230842.04448.peng.zang@gmail.com> X-Miltered: at concorde with ID 4746D8B0.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; hash:01 peng:98 peng:98 wrote:01 caml-list:01 arbitrary:02 ensuring:02 objects:02 inheritance:03 internals:03 gnu:03 enlighten:04 message-----:05 pgp:05 pgp:05 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hey Jon, I was hoping someone else would answer your question and enlighten me as well, but that doesn't appear to be happening. Sooo, here's my .02 I don't think there's an easily way to do this for an arbitrary object. The main problem being the difficulty with ensuring that the return object has the same methods as the original (plus some others). That would require inheritance at an object level as opposed to class level. Alternatively if one knew how messages to objects happen, one could create a wrapper object to provide the new methods and passthrough any messages it doesn't recognize. But I have no idea how the internals of messaging happens. Peng On Saturday 17 November 2007 09:43:59 am Jon Harrop wrote: > Given an object that provides a variety of methods, how do you create an > return an object that augments the given object with more methods? -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFHRtisfIRcEFL/JewRAtu3AKCX4EsMl2voDuUlg49X78uM0ZgPiQCeMHBt 7K3oParomxx8Td4ewoa3u/4= =Z9Zz -----END PGP SIGNATURE-----