From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30335 invoked by alias); 6 Apr 2009 23:32:58 -0000 Received: (qmail 30296 invoked by uid 22791); 6 Apr 2009 23:32:54 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_47,J_CHICKENPOX_54,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Apr 2009 23:32:49 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n36NWiBQ027308; Mon, 6 Apr 2009 19:32:44 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n36NWjcV029711; Mon, 6 Apr 2009 19:32:46 -0400 Received: from opsy.redhat.com (vpn-12-50.rdu.redhat.com [10.11.12.50]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n36NWiHV017019; Mon, 6 Apr 2009 19:32:44 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 909C9888034; Mon, 6 Apr 2009 17:32:42 -0600 (MDT) To: Thiago Jung Bauermann Cc: gdb-patches@sourceware.org Subject: Re: Python pretty-printing [3/6] References: <1238790861.3236.72.camel@localhost.localdomain> From: Tom Tromey Reply-To: Tom Tromey Date: Mon, 06 Apr 2009 23:32:00 -0000 In-Reply-To: <1238790861.3236.72.camel@localhost.localdomain> (Thiago Jung Bauermann's message of "Fri\, 03 Apr 2009 17\:34\:21 -0300") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2009-04/txt/msg00118.txt.bz2 >>>>> "Thiago" == Thiago Jung Bauermann writes: Thiago> I think most of these methods could be attributes instead. Ok. Thiago> The ones which should stay as methods are those who have Thiago> side-effects (like causing a symtab to be loaded, or Thiago> somesuch). Even the methods which create new types only do so Thiago> if the requested type doesn't exist yet, IIUC. Are there Thiago> side-effects in, say, Type.pointer or Type.reference? Only allocation, as far as I can tell. That seems safe enough. Thiago> Also, another no-no for an attribute would be if its getter Thiago> would throw an exception. Thiago> WDYT? I'll do it. This strengthens the argument for changing the Type constructor now, if we want to. We might as well make all the changes at once :) What do you think of a static method named "Type.lookup"? Daniel? Thiago> What about making Value.type an attribute? I remember thinking that we couldn't memoize a value's Type. But now I'm thinking that I remember this from before type reference counting; and on the branch it seems like it ought to be safe. Type is still a bit weird. We don't have a way to compare Type objects, which makes them hard to use in dictionaries and whatnot. One idea would be to compare the underlying struct type, with the proviso that, in the current gdb, this won't always work correctly for types with no associated objfile. This would be an improvement, at least, and we could lift this restriction later. Tom