From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16091 invoked by alias); 10 Feb 2015 10:54:32 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34492 Received: (qmail 25337 invoked from network); 10 Feb 2015 10:54:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=x-sasl-enc:date:from:to:cc:subject :message-id:references:mime-version:content-type:in-reply-to; s= mesmtp; bh=h29OxWnSeyT0RLhWm1CWe5xO6Hc=; b=RwfM3Gm6BW0MipalACaGS vqm3aujCnoOFsmZZJYHhHiMLLwzn88aai/sgK16a5+9yoHTPHIIWV2NWJlROHgI3 bdYyFotZxz9xaIHaxVUli5M1qhyFtuz9Dt1hfMndrP3Qo9m6IzA8GLTD50RrTmXq jmYhprKK69S8cpOf5K6+XY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:date:from:to:cc:subject :message-id:references:mime-version:content-type:in-reply-to; s= smtpout; bh=h29OxWnSeyT0RLhWm1CWe5xO6Hc=; b=iR4DAs6TlS+xH+//SPvl M2xcAiCPK6ZP35SA4XueUMTzB54f4mxDy04E73xk3dvFkjfowtzBN/zqRw5sv4Si HeBHQWb1oKZmm6ZYwZkXSKIVUttTOSyEXQdXjkIkunIcn4YLXuKyglW2RgAX9OnQ 9+p0F2yCpc1zrPC58rqK8Qk= X-Sasl-enc: dJRCjjiOJk4t6YIOi8iwPJkkwIz4hG15GRIvM9o1MKyD 1423565656 Date: Tue, 10 Feb 2015 10:54:14 +0000 From: Daniel Shahaf To: Peter Stephenson Cc: zsh-workers@zsh.org Subject: Re: BUG: $_ empty on null function call Message-ID: <20150210105414.GC1834@tarsus.local2> References: <54D89C52.6050702@askmicah.net> <20150209122042.35b74995@pwslap01u.europe.root.pri> <20150209141026.GB1833@tarsus.local2> <20150209142507.348fa42a@pwslap01u.europe.root.pri> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150209142507.348fa42a@pwslap01u.europe.root.pri> User-Agent: Mutt/1.5.21 (2010-09-15) Peter Stephenson wrote on Mon, Feb 09, 2015 at 14:25:07 +0000: > On Mon, 9 Feb 2015 14:10:26 +0000 > Daniel Shahaf wrote: > > There are some other differences between anonymous functions, e.g., they > > don't honor PRINT_EXIT_VALUE: > > > > Engineering-wise, the ideal solution would be for anonymous and named > > functions to share code... though I realize that may be a somewhat > > invasive code change. > > They already do everywhere that doesn't deal with the special argument > syntax (Micah's problem) or with immediate execution after a definition. Sorry, I know they have execshfunc() in common. I was trying to suggest that anonymous functions should start using execcmd(), which named functions were using, in order to reuse its handling of $_ and PRINT_EXIT_VALUE. > I suspect this may have to do with a different path owing to an > optimisation later in the execution path where we make certain > assumptions if code is regarded as "simple". This is inevitably a > maintenance headache and we've had lots of issues there. > For what it's worth, "() {} foo bar ; print $_" reproduces Micah's problem and, both before and after your patch, doesn't go through execsimple(). Cheers, Daniel