From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10961 invoked by alias); 19 Jun 2015 16:09:12 -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: 35530 Received: (qmail 4295 invoked from network); 19 Jun 2015 16:09:10 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL 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=SmtzlkKvRiLv7K+eLlXlvn1sjmz1jzhMS8qlbPLMnI0=; b=LvC6MZlJt9r9JUwhcuWlML8UhDyc5RE9l5UhbIGUbG/542BzviUDJPc/wKayDmIhle 3CqXLjIwoNxaYuiwOHDnZ8USoZagrVN2r3RjUHvxc7ACtFhqvvt3uMvCJtP4scRExWX2 o0GEf6yeGkbVRTazT3wPPQpYB02hEZhxvnavYcCp5aLmXHkYNh/CQ7mse9DurNNaEG5X lxTj4x7ZHcU8+eTwiWFvVzeyPuOcVK4Rq/E5RPrxjeZVwH50Q7bz68q5KWBOzUI7KQm+ eMyIRKVAlD8uPvyFrxM6mFQgA1TkPJd4keqcmnGhAAVS2SMlaHoSCrK1GwnyO+m/N/f5 tJJw== X-Gm-Message-State: ALoCoQlL6GXSgeqBYjYCFHqX2LlusAykaTtr7kvpRzJ0M+6ZrYoIDudbteZHPIzcDUq1cu3Se/tB X-Received: by 10.60.145.228 with SMTP id sx4mr14019699oeb.79.1434730147602; Fri, 19 Jun 2015 09:09:07 -0700 (PDT) From: Bart Schaefer Message-Id: <150619090904.ZM4132@torch.brasslantern.com> Date: Fri, 19 Jun 2015 09:09:04 -0700 In-Reply-To: <20150619123930.2688d9e3@pwslap01u.europe.root.pri> Comments: In reply to Peter Stephenson "Typeset with array" (Jun 19, 12:39pm) References: <5578996E.3080700@thequod.de> <150610191427.ZM30841@torch.brasslantern.com> <5579C247.1060800@thequod.de> <150611183639.ZM32247@torch.brasslantern.com> <20150612094237.338f79d5@pwslap01u.europe.root.pri> <20150619123930.2688d9e3@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "Zsh Hackers' List" Subject: Re: Typeset with array MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 19, 12:39pm, Peter Stephenson wrote: } } Building on the above, I've developed a Cunning Plan so that it's not } too disruptive and is a few days rather than weeks of spare time. } } It works like this. } } Reserved words are added for typeset synonyms that can handle arrays: } [...] } The reserved words trigger variant handling in par_simple(): WC_TYPESET } is very similar to WC_SIMPLE but there's an extra count and set of } assignments tacked on the end. Thanks for going on with this. I had been toying with the idea of having the reserved word act something like typeset -L2 name foo=bar array=(here there) ==> foo=bar array=(here there) builtin typeset -L2 name foo array so that the parsing of the builtin remained unchanged, it would just need a flag to say that the temporary values from the prefix assignment should become the stored values of the named arguments. This is similar to e.g. y=3 integer x=y which assigns 3 to x. However, I'm not up to speed enough on wordcode to not waste a lot of extra time figuring out how to perform that transformation. The other complications with any implementation are: 1. It's now possible to assign both arrays and scalars in one statement. - what happens for typeset -a x="string" y=(word list) ?? 2. We don't have a distinct syntax for associative array assignment, so this still works only for ordinary arrays. - ksh of course uses h=([key] value) to assign an associative array.