Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: anonymous functions, full patch
- X-seq: zsh-workers 25261
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: "Zsh hackers list" <zsh-workers@xxxxxxxxxx>
- Subject: Re: PATCH: anonymous functions, full patch
- Date: Tue, 1 Jul 2008 19:43:49 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=xQb0V3tnNatc3eyFjEGHMOt1Fa/qW+59SekHnODtB/I=; b=ugXplImjQk74K2tYaUv5BYTFMwKWJEPT9LsFA86VbprdWTq33ucdwjhvC1vBFoTRHN qOQbD0H8kbY52XwTDEcN7rWUrBL0tBXIwjUkIDuudfOvzIfsXZaROV93Wa49e6j2ZTBN 9bFN6/JyjyG6YjgMHEV8suaVjhrV2dch40tKg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=GDVOJnD5qScMZBVdFBJEMmElK/c+DzUl1ds5kFbv2fL+ehBpDQX5Q7RqkZy4FNb7ee OD3Krv06N4jlwNU+jZL7Go0+r2hf8Tl52UiNf/0h81NopuubVqtDkPj8W6QrggBfeUqd +eYPy2kvqboR+04LL7djaku9Y/LFDK9pWiL/0=
- In-reply-to: <20080630112722.3e7eb215@news01>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <18441.1214488302@xxxxxxx> <9646.1214491732@thecus> <200806261506.m5QF6aCd019139@xxxxxxxxxxxxxx> <080626101233.ZM2893@xxxxxxxxxxxxxxxxxxxxxx> <200806261729.m5QHSr5F021201@xxxxxxxxxxxxxx> <20080630112722.3e7eb215@news01>
2008/6/30 Peter Stephenson <pws@xxxxxxx>:
> On Thu, 26 Jun 2008 18:28:53 +0100
> Peter Stephenson <pws@xxxxxxx> wrote:
>> > } Positional parameters from the surrounding area would be hidden and the
>> > } local parameter list empty. I could easily copy them in so that they
>> > } could be used and modified without affecting the calling environment.
>> >
>> > I'm of two minds on that score. On the one hand it'd be nice to be able
>> > to get at the surrounding $@. On the other it may often be a needless
>> > expense.
>>
>> Indeed, though unless your parameter list is humongous it won't be a big
>> effect. On the other hand. humongous parameter lists are not unknown
>> with things like zargs.
>
> The way the internals work we would have to copy the list to pass down, but
> we wouldn't have to copy the strings. Anything cleverer (that makes a
> significant difference) is quite a lot of work. I've left this out for
> now.
>
> Here is a slightly more optimised patch with documentation and tests.
> In principle I think it can be optimised more, but I don't think it's worth
> it.
I played a bit with this to see what works and what doesn't, and I
came across this non-working syntax (which is also obviously useless,
but still):
() a=b
zsh: parse error near `\n'
while these work:
() { a=b }
setopt shortloops; for a in a; a=b
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author