From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3319 invoked by alias); 11 Jul 2010 18:49:59 -0000 Received: (qmail 3311 invoked by uid 22791); 11 Jul 2010 18:49:58 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_05,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 11 Jul 2010 18:49:54 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6BInRJM006934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 11 Jul 2010 14:49:28 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6BInRK7005498; Sun, 11 Jul 2010 14:49:27 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o6BInQIv030065; Sun, 11 Jul 2010 14:49:26 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id DF56A37818E; Sun, 11 Jul 2010 12:49:25 -0600 (MDT) From: Tom Tromey To: Joel Brobecker Cc: Doug Evans , gdb-patches@sourceware.org Subject: Re: [RFA/python:2/2] First script in GDB python library - command/pahole.py References: <1274918921-23200-1-git-send-email-brobecker@adacore.com> <1274918921-23200-3-git-send-email-brobecker@adacore.com> <20100603001115.GJ3019@adacore.com> <20100603153459.GK3019@adacore.com> Date: Sun, 11 Jul 2010 18:49:00 -0000 In-Reply-To: <20100603153459.GK3019@adacore.com> (Joel Brobecker's message of "Thu, 3 Jun 2010 08:34:59 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (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: 2010-07/txt/msg00201.txt.bz2 >>>>> "Joel" == Joel Brobecker writes: Joel> I think that if we want to have help and apropos working, we might Joel> as well just use the simpler approach of running the command scripts Joel> right from the start. I have been thinking more about this problem recently. One idea is KISS: just load all the commands and functions at startup. I avoided this initially out of fear that it would be too slow -- but I never measured it. Maybe it isn't so bad. A second idea is to install the Command objects eagerly, but have the implementation lazily load the actual code. That is, there would be a single Command subclass that would take a help string, a module name, and a class name (string) arguments, and then when the user invoked the command it would import the module and instantiate an object to which the command operations would be delegated. This approach would work for convenience functions, too. It is also easy for 3rd party users to use. Also, we can always start with KISS and move to the lazier approach if it turns out to be too slow. Tom