From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1327 invoked by alias); 21 Aug 2015 15:29:29 -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: 36267 Received: (qmail 18771 invoked from network); 21 Aug 2015 15:29:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=B7hHl54S4aPVD+m0RNt+mVeb+/0JN7o9NXA4BBC36nk=; b=iUy0gHJi1D3rxWSe/aktjeNM2tjefJk2o07Cj+FzNIvo/msjf5O0Xp5tJVQT8KZsua UDIy0s3oRodmCPVuv5qsO3Pqj/2qJGl5U+iYr5BqM3IMJSSvL+wO21+6yM+F7FH40uWK 1RqbNeaoioOQMT5XSUdJIdXwq1sOamB0iFUWzGcMoyQrIFIXad1QXAk2aVH6kxjSIKZy Trv5GCbJ5RtylObbfWWOSY3wv8iYlKmSJGUZt5FXgPi3PzP+NEeSL9GbYrG05X9kppIy 0uRKfiju3ZcO18u2qIk2K5jzuaxi3Xf/OmEpFt19s7Tx2YIGDy72rYGc6y9x7wq1+lha AEWg== X-Gm-Message-State: ALoCoQlzUC/UXjH5xuzgUGwuiBHZVlqoo56HA4o7eeIYMYqeg/1cdyLLd4RJ4jQRsW/MnsuVvkEw X-Received: by 10.202.200.75 with SMTP id y72mr7949197oif.111.1440170966554; Fri, 21 Aug 2015 08:29:26 -0700 (PDT) From: Bart Schaefer Message-Id: <150821082923.ZM11413@torch.brasslantern.com> Date: Fri, 21 Aug 2015 08:29:23 -0700 In-Reply-To: <20150821155249.3f773977@pwslap01u.europe.root.pri> Comments: In reply to Peter Stephenson "Re: Anonymous function syntax and "sh" emulation" (Aug 21, 3:52pm) References: <150820211638.ZM29649@torch.brasslantern.com> <20150821155249.3f773977@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Anonymous function syntax and "sh" emulation MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 21, 3:52pm, Peter Stephenson wrote: } } What's worried me is the other part of the effect, which isn't specific } to sh emulation, which is that the first word after "function" is } treated as not a command word, while the remaining words are treated as } command words: } } I would hazard a guess this is a bad thing, which hasn't been noticed } because multiple words after "function" aren't very common. This is especially interesting in that exactly the opposite happens when defining multiple functions WITHOUT the "function" keyword: torch% alias first='fn1 fn2' second='fn3 fn4' torch% first second () { print $0 } torch% functions fn1 () { print $0 } fn2 () { print $0 } second () { print $0 } } I suspect we can just move the "incmdpos = 1" until after we've found } something that is either not a STRING or a possibly tokenized "{". Not } included in the patch below, but I'll do it unless anyone contradicts. I would say that prefixing with "function" is a good workaround for the function/alias conflict (maybe even update FAQ 2.3 to describe this), so it is good if none of the words are treated as command aliases.