From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8319 invoked by alias); 6 Sep 2016 00:20:52 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21839 Received: (qmail 14416 invoked from network); 6 Sep 2016 00:20:52 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.28):SA:0(0.0/5.0):. Processed in 0.112003 secs); 06 Sep 2016 00:20:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=ktRvN+TX7Xb+AuIx uj1K0JR2sJI=; b=zTKWzjj7pi9hCcKxbd6GC1BhWotKEHFU0DWN7LtWIPbD7LlY vivj8jDVM27E5GvyWhMJyIQqpXrW9lxCM5dKLSGm5l4Kq+E/gwirOF+51vU3YSai rgsKh3ewvvUYNbsla7ymjKo0DlECnPhQie7VhVAe3XxvPdr8Tnz6UcK50oA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=ktRvN+TX7Xb+AuI xuj1K0JR2sJI=; b=Ssq+4RepA45tBvPNPvPo1orHMjsu8FR20b+ng+KQhxFX+LO ED7HaZ8lvdmz3/3bxYCcYDTWee7vOIwmWgkD1u+iSGy2N0eyZyNX4u5AXg5tZmGG 4PFDffpymPx0jiExQewBIvKQLESjumlPAMDSyIdvHt022/L9Rz9hx8s2f5oo= X-Sasl-enc: gR7rBBOujEHqOfaZy+OWHYoaXvGm+g9ijmarb77H4s1W 1473121249 Date: Tue, 6 Sep 2016 00:20:16 +0000 From: Daniel Shahaf To: Sebastian Gniazdowski Cc: Zsh Users Subject: Re: Implement a key-value deserialization or something similar Message-ID: <20160906002016.GB30336@fujitsu.shahaf.local2> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sebastian Gniazdowski wrote on Mon, Sep 05, 2016 at 22:47:11 +0200: > Hello, > I'm wondering how to best implement a parameter $x, say $7 – I mean a > last parameter to a parameter-rich function – that would serve as "put > various key-data things here to stop adding more parameters"? Possible > call could be: afunction param1 param2 ... "MYDATA=1 OTHERDATA=true" Like this: % local -A reply=(mydata 1 otherdata true) % () { echo ${${(P)7}[otherdata]} } {1..6} reply true Or you could adopt the Perl convention: () { local -A args=( "$argv[@]" ) } mydata 1 otherdata true