From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5668 invoked by alias); 19 Jun 2015 17:41:44 -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: 35532 Received: (qmail 18788 invoked from network); 19 Jun 2015 17:41:41 -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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1434735387; bh=vxQLYVLrkJx1H8xVSLOVLgLgpe4GyrQvWapPgwe+EsM=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=H7fbRBTJg0la+7gGMQJhhMx7cEeUa5vptqKMGp6CdpazVAd0YPdCIodc4H+mfHzgHaq4LQtzIcamCyy1I6XLREh/XShtHbtQ/LaUPS/vyuuSg0V/k6bmgP7aMzPun4DdM3ezPNfm5nAGuVk24vecAX6LzI7UpnMOyM0KfpZyJMRdy2RdqqNEzhvkhOJwr1NIAU0mna70HOrZ5xY1eIYBGdIHvlQ7ogPheN+skFPenyaLXj3qmlkix4qKdjr8Ku346ufgwPROG1nmRoLEHchdzW7o281zXKXNw6tfJFLYzfIIGR5r3T9U5/L1rYiqzMpe4Q1LShCO3Ws3nqJf8mjjPA== X-Yahoo-Newman-Id: 374497.98317.bm@smtp112.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: vX1rUCYVM1n28fjFUHsRcJ8N6IJUsG2IKthYxoNDj.oYI0g NHLljs94RhNKDFdqKkUVBMq67mR1JkCnvfkwlySzWN7IdDV.CCzbwmBzIgtz xTv7h8yEMDoMSGzc1mF7WPTCB5mpUvV4atpL.33rawQFkhQf6vDOZJelqmVl 8UuO1j1oHakHB0sYR3CspluOQkx8do6o6MBXJGM8qbzbvYaQCrLO0gO1IHnh HeTPz8DRxFyJrgUrSrWtKwrK6tzYeQrScagX9GGP4mMS8.ZiT4hTjvAA5NTI gEQYgLsxLUjbKmLZluD8pZ.M50xc2HR6EOVzoO.H.FvvHJKmElPNStFsyFCx s6kmvg8c0oAcEhDxrKjWYvEmMA4A6qtHxGus30e5Go0AtAexutoqbgNbhcfR YWl3KI68gYXMFJgN6fjIVmOCNUGbcgF_oXM1qfp_nz9qmhhiBpgxQHC9Myk. Hy8js.o_tRj1GbYgAVB.UW4tt1ZJkcsLgSwpjomuHxIeUR0OjW01sFdoOB9n vC.48sHeCz95311za5WnyPcp.rfCQmA-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <20150619123930.2688d9e3@pwslap01u.europe.root.pri> From: Oliver Kiddle 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> To: Zsh Hackers' List Subject: Re: Typeset with array MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7336.1434735385.1@thecus.kiddle.eu> Date: Fri, 19 Jun 2015 19:36:26 +0200 Message-ID: <7337.1434735386@thecus.kiddle.eu> Peter wrote: > Here's where the Cunning Plan comes in: the spcial assignment behaviour Firstly, this looks fantastic. Much of my initial basic testing seems to already be working. I'll mention some of the things I tried. Just in case there's something you hadn't thought of. Some combinations aren't especially sane but might want an error message. local -a foo=one So scope needs to be handled first and array conversion later. Similarly: typeset -i foo=(23) I did something like the following in _git recently. It works arr=( one two three ) local $arr There is also local $^arr=foo and local $^^arr=foo The nearest in bash would be: declare {a,b,c}=foo which works, but not: declare {a,b,c}=(one two) Bash apparently lets you use += with declare but it seems to be meaningless because it is not using the value from the outer scope: $ foo=hello $ function foo { > local foo+=bye > echo $foo > } $ foo bye $ echo $foo hello Ksh doesn't allow it. Printing an error in this case seems best which is what you have: typeset: not valid in this context: var+ Bash allows array element assignments: typeset var[4]=hello Zsh now prints "can't create local array elements" Including when not in a function. That could also be extended to something like var[2,7]=(1 2) This is perhaps jumping ahead a bit but for completion, it seems we now get -command- context after typeset. As long as -var- context is applied inside the actual contexts, having -command- context otherwise for typeset would probably work fine. It seems that it is already possible to have assignments after nocorrect so there may already be handling for this situation by copying whatever is done for nocorrect. Is there a reason why noglob can't precede assignments. That could be useful. Oliver