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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 5FE2FBB9C for ; Fri, 16 Sep 2005 00:15:39 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j8FMFcgk016927 for ; Fri, 16 Sep 2005 00:15:38 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA27150 for ; Fri, 16 Sep 2005 00:15:38 +0200 (MET DST) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.203]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j8FMFbpH005304 for ; Fri, 16 Sep 2005 00:15:37 +0200 Received: by zproxy.gmail.com with SMTP id f1so155146nzc for ; Thu, 15 Sep 2005 15:15:37 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gq76gtZLdFMFXm/xj0rf/HunkwKrWp0GihhOPzgjRJHPOpmuytxecWUJOszF6Akb8VqsegkdG0FYbOT5IUss0BBCHyiIykfzTDgDd1n2KBSJx+0yUSP92ph/DxiVwX0cC52FDd4AYLbKpQJeCwP0gR9a3pTR6Q/EzNeYp5UKJmY= Received: by 10.36.17.7 with SMTP id 7mr26792nzq; Thu, 15 Sep 2005 15:15:20 -0700 (PDT) Received: by 10.36.80.3 with HTTP; Thu, 15 Sep 2005 15:15:36 -0700 (PDT) Message-ID: Date: Thu, 15 Sep 2005 15:15:36 -0700 From: "Corey O'Connor" Reply-To: coreyoconnor@gmail.com To: david.baelde@ens-lyon.org Subject: Re: [Caml-list] Heritage Cc: caml-list@inria.fr In-Reply-To: <53c655920509151501140404d@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <53c6559205091513486a10b481@mail.gmail.com> <53c655920509151501140404d@mail.gmail.com> X-Miltered: at concorde with ID 4329F28A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4329F289.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 decorator:01 decorator:01 endl:01 endl:01 buffer:01 corey:98 ...:98 ...:98 wrote:01 argument:01 instances:02 std:02 std:02 pattern:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 On 9/15/05, David Baelde wrote: > I don't think the decorator pattern fullfills my needs, cause it does > not allow you to end up with one object having an added method from > one decorator and an other one from a different decorator. You can > compose decorators, but you'll only see the methods of the last one. I don't follow your argument why a Decorator would not work. What do you mean by "the last one"? (Again sub-par C++ typed directly in Mail) class IBuffer { public: =09virtual void SomeMethod() =3D 0; } class CBuffer : public IBuffer { public: =09void SomeMethod() =3D { //... Whatever... } }; class CDiscoBufferDecorator : public IBuffer { =09IBuffer* mDecorated; =09 public: =09CDiscoBufferDecorator(IBuffer* inBuffer) : mDecorated(inBuffer) {} =09 =09void SomeMethod() =3D=20 =09{ =09=09std::cout << "Disco!" << endl; =09=09mDecorated->SomeMethod(); =09} } class CFancyBufferDecorator : public IBuffer { =09IBuffer* mDecorated; =09 public: =09CFancyBufferDecorator(IBuffer* inBuffer) : mDecorated(inBuffer) {} =09 =09void SomeMethod() =3D=20 =09{ =09=09std::cout << "Not really that fancy... " << endl; =09=09mDecorated->SomeMethod(); =09} } IBuffer* theFancyBuffer =3D new CFancyBufferDecorator(new CBuffer); IBuffer* theDiscoBuffer =3D new CDiscoBufferDecorator(new CBuffer); IBuffer* theDancyDiscoBuffer =3D new CFancyBufferDecorator(theDiscoBuffer); Three instances that all conform to the Buffer interface but with different "decorations". So there would be one object with one decorator (theFancyBuffer) and another object with another decorator (theDiscoBuffer). Isn't that behavior what you want? --=20 -Corey O'Connor