From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14691 invoked by alias); 11 Feb 2011 18:18:01 -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: 28746 Received: (qmail 1010 invoked from network); 11 Feb 2011 18:17:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110211101729.ZM525@torch.brasslantern.com> Date: Fri, 11 Feb 2011 10:17:29 -0800 In-reply-to: Comments: In reply to Greg Klanderman "anonymous functions" (Feb 11, 12:17pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh list Subject: Re: anonymous functions MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Feb 11, 12:17pm, Greg Klanderman wrote: } Subject: anonymous functions } } >>>>> On February 11, 2011 Bart Schaefer wrote: } } > If your zsh is recent enough to have anonymous functions } } Why are these things called 'anonymous functions'? That name connotes } lambda, which would create an unnamed function you could store in a } variable Unfortunately it really only means an unnamed function for scoping, so you can use "local" and "return" to save/restore variables and set the status. It does not connote a closure (is not like a lambda expression). This is partly for simplicity of the implementation, but partly because the shell language doesn't really provide a syntax for returning values from functions or commands (except in the limited context of $(( ... )) math expressions) -- hence all the hacks with $REPLY. See zsh-users/15575 from last November: http://www.zsh.org/mla/users/2010/msg00874.html