From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4181 invoked by alias); 21 Sep 2016 19:57:23 -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: 39406 Received: (qmail 3028 invoked from network); 21 Sep 2016 19:57:23 -0000 X-Qmail-Scanner-Diagnostics: from nm23-vm1.bullet.mail.ir2.yahoo.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(212.82.97.16):SA:0(0.0/5.0):. Processed in 0.60053 secs); 21 Sep 2016 19:57:23 -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=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: okiddle@yahoo.co.uk X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.mail.yahoo.com designates 212.82.97.16 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1474487470; bh=mByrI6GrqDbgRuMKikJX6Gj4GdsHUunDq6A25AXemeA=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=W7bPzEvRVLVDwehPGe0fRNRZwjgAo1JX5SzjhgYBNLbcLD1g3u9POj6lZ5hyifB8J+EnTstSCsTpYJfCBPmNCkissdIT3Yvb+ZoAe4TyCFN1E30L8aYWA2HKXSEJuPpegX5xr5ogcrP6T+K4ZQ0L74kdo6X7iMy4QnN7T/o3ezTThI0g/w2wJK5vtwCuthaaccaoD/lc581iUht8yDZBVGMXtorGBJebZ30rEiIv74FrFHbxf2LbjUt/AMm0rbcLjilWxBka65gozFL6JSUQdeN2Vzlmw4jTopaRfYMoSCmIHNwvSiXo123Lq8sgPUZFGvRow4loQ6q8Qo4UV7uirw== X-Yahoo-Newman-Id: 181352.65968.bm@smtp138.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: yfT.54UVM1kXtYwYfbYn0Du1tZRiuz1.ZkAZe7uJKnfFjso YOXt1byu0gtrhL7kmeeIYV3icdzS9Af9yjCN5SDODA.1COvmjqR2Dt1reFi3 4Lt95nSaLbaTQn9yET0BgI77dwXWnTFOE7b2kK7sbZP.FE45tS97981D8Kuw riOwro909Ww1MjBy9FWWPxHM9FVlZcVBsyWlRTsamcPN9uu.cruIJIlOTb.k yLFLLaUJKh0d3omi_t6858_hcmItH.94EcouLqWLmMWtEG0b18Sb6tPPppCV IfKzIDpsrzMYXMPFjkjkPyQGZmX6g9fVDyxfshS01WjTduGLN5yXJp7JwRBN vK4I73ibNMNmWAna8bhS7hh0RkPqp9N_YWIPI2WMQxKQS9AQtpkAwSbeIvWG j2OJXf20eUioKJ2cmEPVzYBzOw32P1wAOb9rkOw_rMlPAnZZc0mk5ynWaCVF JvbtczqP5avCeSmAa9Wne2SE42KIZAaBTiAe4t7DpYwmO5il_em6taNFdbnR Fc39flbTZIme8Vu0XzRnhmNzuZs5Q6x8Md0NqXS6DuwQ- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <160919133047.ZM28795@torch.brasslantern.com> From: Oliver Kiddle References: <53992.1474303843@hydra.kiddle.eu> <160919133047.ZM28795@torch.brasslantern.com> To: Zsh workers Subject: Re: PATCH: print -v with an array MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <76610.1474487469.1@hydra.kiddle.eu> Date: Wed, 21 Sep 2016 21:51:09 +0200 Message-ID: <76611.1474487469@hydra.kiddle.eu> Bart wrote: > When did we get the ability to do "print -z -f ..." It might be Not long after printf itself was added. > useful to have every reuse of the format add a separate entry to > the buffer stack. Similarly for "print -s -f" and the history. I doubt that anyone would notice a change of behaviour. Is multiple entries definitely more useful? > (Currently -S is silently ignored if -f is given. Hmm. Not sure > how that ought to work anyway.) -S is also missing from the completion function so I've missed that. The only way it could work is for the parsing and splitting to be done last. It doesn't even take more than one argument at the moment. > I'd lean toward the -A option (especially if we alter -z / -s as I Being able to create the array direct is nice and it is more consistent with read and set. My concern was that adding ever more options causes the most commonly used ones to get buried in documentation and completion listings. > just mentioned above). Right now print -v / printf -v can create a > variable (for which BTW we are lacking a WARN_CREATE_GLOBAL warning), WARN_CREATE_GLOBAL is handled internally to setsparam so that's covered. > I see you've implemented it by building up the array and then doing > the assignment all at once, rather than appending one element at a > time. This makes it possible to use it for associative arrays, even > though it'd be a bit unusual to have the same format for both keys > and values. While it's only five lines of code to check for a hash and use sethparam, it just doesn't seem useful enough to do that. > } > - Should "print -v foo bar" write the trailing newline into $foo ? In the > } I'd suggest we include the trailing newline if the -l option was > } specified. Seems it does get included with -c. > > It's probably a mistake/oversight with -c. The *embedded* newlines > always get included. The question is whether > > print -l one two three four > and > print -l -v stuff one two three four > print "$stuff" > > should produce identical output, rather than the latter having two > consecutive newlines at the end. Whichever way we decide, the same > really should also apply to -c. I'd vote for the two consecutive newlines in the case of both -l and -c. Oliver