Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: arguments to anonymous function
- X-seq: zsh-workers 29496
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: "Zsh Hackers' List" <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: arguments to anonymous function
- Date: Mon, 20 Jun 2011 03:28:23 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=FVHq7UDd2ejse7B9yJju8/wV+rVOM7QIBIEPuNePlG4=; b=BkVLoVlvO/ENvp7+Btb2hlN3PpFdE6FfgcivuK7bVo+0e4x4lYW7TI0eugloPFDvMQ +pwBR3zJaGKyBMbzvudGr9unzyLVW9g/871mbiOpKXlf6njUowHAmd8gzbVTFQ2ux1mB W+qPKzhOSoyuf7c5IBLkgQc8AzxiU46OiSoWA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=tO2Z3tCjGUvEAcYssQgCfrlY0lVMVybNMcr95uYBGExnueqNo0N72Qn5bZ737B0Pgh T8tu9rQTqfyXuVOttzmsSWUSycFaSx2Lg29aJX53Dzi9Qe5l+5jBNCt/xiMlaYhAja2l 2xHkesdxo4PBvOSDTGc5Gki7uhxUvb92+8EDw=
- In-reply-to: <20110619191400.4aff850e@pws-pc.ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20110619191400.4aff850e@pws-pc.ntlworld.com>
On 19 June 2011 20:14, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> This adds arguments to anonymous functions. The only easy way of doing
> this without trampling on other syntax is to pass them after the final
> brace, where previously it would have caused a syntax error so it's
> unproblematic. I hope that's not going to be too inconvenient.
Cool, I remember wanting this a few times. I just don't remember what
for :). It sort of lets you do array things to globs without assigning
a var first pretty easily, () { print -l /foo/${(U)^@} } Src/*.c
Or arbitrarily nested glob qualifiers, I'm sometimes bothered by not
being able to do foo(xyz)/bar(abc) where xyz would be glob quals to
apply on the foo segment, and abc on bar.
() { () { print -l $^@(e:'REPLY=${(U)REPLY}':) } $^@/*(.) } *(/)
(This is a stupid example, but maybe it gets the point across. :) No
idea why I'm so fond of uppercasing things tonight.)
A heads up, this patch may make zsh crash on startup when reading .zwc
files from before the change. A simple workaround is to either touch
the source file or remove the .zwc files. (Maybe we should bump the
-dev version so this doesn't affect too many people?)
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author