This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: [python][rfc] Attempt to print the base class if a there is no Python pretty-printer for a derived class.
- From: Pedro Alves <alves dot ped at gmail dot com>
- To: archer at sourceware dot org
- Cc: Phil Muldoon <pmuldoon at redhat dot com>
- Date: Fri, 27 Mar 2009 17:43:10 +0000
- Subject: Re: [python][rfc] Attempt to print the base class if a there is no Python pretty-printer for a derived class.
- References: <49CD0730.8070000@redhat.com>
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<int, char *>
> {
> 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