This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [python][rfc] Attempt to print the base class if a there is no Python pretty-printer for a derived class.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]