From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14459 invoked by alias); 27 Mar 2009 17:43:15 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 13920 invoked by uid 22791); 27 Mar 2009 17:43:10 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,SPF_NEUTRAL X-Spam-Check-By: sourceware.org From: Pedro Alves To: archer@sourceware.org Subject: Re: [python][rfc] Attempt to print the base class if a there is no Python pretty-printer for a derived class. Date: Fri, 27 Mar 2009 17:43:00 -0000 User-Agent: KMail/1.9.10 Cc: Phil Muldoon References: <49CD0730.8070000@redhat.com> In-Reply-To: <49CD0730.8070000@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903271743.11238.alves.ped@gmail.com> X-SW-Source: 2009-q1/txt/msg00424.txt.bz2 On Friday 27 March 2009 17:04:48, Phil Muldoon wrote: > The bug is detailed here: > http://sourceware.org/bugzilla/show_bug.cgi?id=10008 > > In summary, given this class: > > class Y : public std::tr1::unordered_map > { > public: > Y() > { > } > }; > > Any Python pretty-printers that have been written and registered to > print std::tr1::unordered_map will not work on Y. But there is no > reason, given the lack of a more specialized printer for Y, why the > printer for unordered_map should not print the parts of Y it can > accurately print. This patch attempts to find a base class printer if a > specialized printer does not exist for the class in question. I don't know a thing about python pretty-printing, so excuse any silly questions, but, anyway... Does this do sensible things if class Y has some fields that mask the Base class's ones, when you only have a pretty printer for Base? Say: class Base { public: int x; }; class Y : public Base { public: int x; }; What about private inheritance, sometimes used as an implementation detail, but not representing an is-a relationship? class Y : private Base { public: Y (); // My API that has nothing to do with Base. // my own data members }; -- Pedro Alves