From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,aae01e0853bff01c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-16 20:37:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!not-for-mail Sender: mheaney@MHEANEYX200 Newsgroups: comp.lang.ada Subject: Re: Should MI be supported (was: Can MI be supported?) References: From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 17 Sep 2003 03:36:59 GMT NNTP-Posting-Host: 65.110.133.134 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1063769819 65.110.133.134 (Tue, 16 Sep 2003 23:36:59 EDT) NNTP-Posting-Date: Tue, 16 Sep 2003 23:36:59 EDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:42597 Date: 2003-09-17T03:36:59+00:00 List-Id: Lionel.DRAGHI@fr.thalesgroup.com writes: > That's where we differ. I feel much more confortable with Bob's > translation, because Colorable is not an object, it's a "properties". Perhaps, but I felt (and still do) that my translation was more faithful to the C++ example. > My_Adapter is an Adapter, so inheritance applies. My_Adapter is not a > "colorable", so i won't inherit from some colorable class. Neither is > "Colorable" a particular "role" of an Adapter. What's interesting is that my example, I only exposed the root interface types: Colorable_Type and Resizeable_Type. I felt that in Hyman's implementation, he exposed too much information; specifically, that My_Object derived from Colorable_Adapter_Type and Resizeable_Adapter_Type. But that's only an implementation detail. What's nice in the approach I showed is that you only have to advertise that you support the root type interface. The fact that privately I "inherited" from Colorable_Adapter_Type and Resizeable_Adapter_Type was only an implementation detail, and therefore I was able to move it to the private part of the spec. Hyman: Is there a way to do that in C++? Can you publicly inhterit from ColorableType and privately inherit from ColorableAdapterType? > It's just a characteristic (note that Colourable is an adjective, > Adapter is a noun), and so i use a Mixin. You may perfectly use > multiple views if you feel better with it. Hyman choose MI instead of > (templates + SI) because the code was simpler to write. But in my > opinion, mixin translate better the problem description. The mixin approach may translate better to the problem description, but it's debatable whether it translates better to the C++ implementation. As usual, YMMV....