From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17533 invoked by alias); 29 Nov 2006 19:08:05 -0000 Received: (qmail 17439 invoked by uid 22791); 29 Nov 2006 19:08:02 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 29 Nov 2006 19:07:53 +0000 Received: (qmail 21476 invoked from network); 29 Nov 2006 19:07:51 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 29 Nov 2006 19:07:51 -0000 To: Rob Quill Cc: gdb@sourceware.org Subject: Re: Checking variable scope References: <20061129190614.GB9754@nevyn.them.org> From: Jim Blandy Date: Wed, 29 Nov 2006 19:08:00 -0000 In-Reply-To: <20061129190614.GB9754@nevyn.them.org> (Daniel Jacobowitz's message of "Wed, 29 Nov 2006 14:06:14 -0500") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00239.txt.bz2 Daniel Jacobowitz writes: > On Wed, Nov 29, 2006 at 10:44:33AM -0800, Jim Blandy wrote: >> I'm suggesting that you extend the grammar even further, by allowing >> one to say things like this (assume there is no binding for 'a' in >> scope, but there is a binding for 'b' in scope): >> >> (gdb) print $in_scope(a) >> $1 = 0 >> (gdb) print $in_scope(b) >> $1 = 1 >> (gdb) > > Is extending the grammar really necessary? That will already parse; > it's the same as you'd use for a convenience variable named in_scope > holding a function pointer. I think so, because you need to prevent the reference to 'a' from producing an error when you parse the expression.