From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6182 invoked by alias); 2 Nov 2011 12:13:21 -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: 29887 Received: (qmail 28626 invoked from network); 2 Nov 2011 12:12:50 -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=-0.9 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at yahoo.fr does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1320235611; bh=E3g/Az6TH7jX3YP4z1hI41DAxEObYuHUcFuqZISRyio=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:Content-Transfer-Encoding:In-Reply-To:User-Agent; b=qqsKbduW7PhHM1+pg2RH8xsoMV4gbAJqJOkKIk4gnfoPcZiF67D5uENPryumL752gA7LDjIWgwgFOlBKbyI7VIn7IEcQDiQDLOyfd6DBhGam99XuMR5Xh4QhXFIsAVjSYHXCZq3V/jH940I+b3kkBlbMj6xAsZQAHmgjAXNHQ+8= X-Yahoo-Newman-Id: 202738.56686.bm@smtp140.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: lRKIYI4VM1m62QDmVopHaK79LRgEWgWFRf4o8lWOkStDsf. 7uTtmUD333PorDTgKU8umENis3fdfQjrFQJ0IpX5tRFhfTDGxhtzul3QX4Kn NUUEPoOuu1XHUSSGs5En4kbqNFguQ3nm2xZ0Gaz6Z4Rk1AtVX3sGRd3tzUfu prUSFSoYRJXThBPETq7uL5ezqAGmYF_QIaH3pWnPOwytSYfU34N0P5d9sVGK 6ySHiQQwL8fCxkYo8PURZsIDdmxhctbTnr5hrzDZb297u4Bij3fC_cINmzoN yPp2x.Aq7SlzyIvuQ8b.FFZza95dOvxZtCfvJG9U_fNpQXifYoBZDk98G0jF 15L14xcyd1CI6hX7258Xow7WTPCE_CLEpjhs1p4Ftbifx8NmpAo_y X-Yahoo-SMTP: V1UR0WuswBDVD1eFhM33188Ir8ciBckz4W8ZMsAh Date: Wed, 2 Nov 2011 12:06:49 +0000 From: Stephane Chazelas To: Mikael Magnusson Cc: zsh-workers@zsh.org Subject: Re: Array as parameter Message-ID: <20111102120649.GB6375@yahoo.fr> Mail-Followup-To: Mikael Magnusson , zsh-workers@zsh.org References: <20111102033545.GI28043@solfire> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 2011-11-02 11:14:38 +0100, Mikael Magnusson: > On 2 November 2011 10:10, Stephane CHAZELAS wrote: > > 2011-11-1, 22:00(-07), Wayne Davison: > >> However, if you need to be able to keep the array > >> parameter separate from other parameters, you could instead refer to the > >> variable whose name you passed in using ${(P)1} in your function in place > >> of the $1. > > > > Except that it doesn't work for arrays. You'd need to  use eval > > here. > > (P) works perfectly fine with arrays. [...] Indeed, though it seems you have to write it as "${${(@P)1}[@]}", I'm not too sure why. ~/install/cvs/pixz$ zsh -c 'a=("" "a b" c d); b=a; print -l "${${(P)b}[@]}"' a b c d ~/install/cvs/pixz$ zsh -c 'a=("" "a b" c d); b=a; print -l "${${(@P)b}[@]}"' a b c d -- Stephane