From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12275 invoked by alias); 8 Jun 2008 18:21:50 -0000 Received: (qmail 12267 invoked by uid 22791); 8 Jun 2008 18:21:50 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 08 Jun 2008 18:21:30 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 5DA749840C; Sun, 8 Jun 2008 18:21:29 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 321119840A; Sun, 8 Jun 2008 18:21:29 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1K5PWC-0001mQ-EF; Sun, 08 Jun 2008 14:21:28 -0400 Date: Sun, 08 Jun 2008 18:21:00 -0000 From: Daniel Jacobowitz To: Tom Tromey Cc: Thiago Jung Bauermann , gdb-patches@sourceware.org Subject: Re: Function syntax (Was: [RFC][patch 1/9] initial Python support) Message-ID: <20080608182128.GA6248@caradoc.them.org> Mail-Followup-To: Tom Tromey , Thiago Jung Bauermann , gdb-patches@sourceware.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2008-05-11) X-IsSubscribed: yes 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-06/txt/msg00142.txt.bz2 On Thu, May 29, 2008 at 02:29:32PM -0600, Tom Tromey wrote: > Recently I've been thinking that $(...) should not simply eval the > '...' as a python expression. Instead, I'm leaning more toward a > function registry approach. I have two reasons for this. This sounds good to me. > * I agree with the lexing point. I think we could specify some > standardized quoting and dequote before passing the argument to the > underlying code. I don't think this is really necessary. It's not like the user would be up a creek if they had an arbitrary character that interfered with the lexer. Except we do need to define what the arguments to specified functions are, and I want a clear answer on that point before anything goes in. They could be Python syntax, or some other well-defined syntax which happens to be similar to Python. Would GDB convenience variables work? As values or as textual substitution? As long as we pick something and document it, I think the choice of what to pick is not too significant. > * I don't want to use $python(...) -- but I was wondering, doesn't > this already have a meaning if 'python' happens to be a > function-pointer-valued convenience variable? Yes, but this is always an issue defining new predefined convenience variables since they share a namespace with user variables. > I suppose my basic proposal is that all functions be derived from > something like: > > class Function: > # ARG is a string, already de-quoted and whitespace-stripped. > def invoke(self, arg): > do something > > def complete(self, text, word): > complete the argument > > This is basically exactly what we do for commands, only in the > Function case we could expect invoke to return a value. Making them complete on a string seems too awkward when writing such things. At function-writing time it would be easier (but less flexible) to specify a list of arguments and have GDB handle the breaking up into words... I know we discussed this before but I can't remember the details now. -- Daniel Jacobowitz CodeSourcery