From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11636 invoked by alias); 1 Oct 2008 05:48:22 -0000 Received: (qmail 11622 invoked by uid 22791); 1 Oct 2008 05:48:20 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 01 Oct 2008 05:47:45 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id EBFC52A96A9; Wed, 1 Oct 2008 01:47:43 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2491k9Oplfc7; Wed, 1 Oct 2008 01:47:43 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id A84712A968F; Wed, 1 Oct 2008 01:47:43 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 99826E7ACD; Tue, 30 Sep 2008 22:47:41 -0700 (PDT) Date: Wed, 01 Oct 2008 05:48:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: Thiago Jung Bauermann , gdb-patches ml Subject: Re: [rfc] expose gdb values to python Message-ID: <20081001054741.GE3665@adacore.com> References: <1221199426.24580.26.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-10/txt/msg00005.txt.bz2 (Sorry I am participating so late in the discussion, but I am still recovering from my summer, and only recently managed to learn some Python) > The underlying question is what type model Value presents. If a Value > has a derived type, should we be able to access fields of the base > class using v["f"]? Or should we need v["Base"]["f"]? My initial reaction to this question is that the Value object should follow the same semantics as the debugger. For instance, if class Foo inherits from class Bar, then any component of class Bar should be directly visible from class Foo. So if X is Value of type class Foo, and class Bar has a component named "Baz", then I should be able to access that component with X["Baz"]. Better yet, I would love for the object to have one attribute for each component that I could simply access using X.baz. But I suspect that there is no way we can implement that without having to compute the value of each component, which would be quite wastful the vast majority of the time. Sigh, is it not possible to lazy-initialize attributes? -- Joel