From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9108 invoked by alias); 23 Jun 2015 20:24:13 -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: 35578 Received: (qmail 15594 invoked from network); 23 Jun 2015 20:24:11 -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.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=cozNvUevigMWXsbWDVKXcF42vcBGvbKWP3JpXCo+ERM=; b=ZgujabGsJa/bp9asiMdFhjDNvbf3Ty3w2sM/Iemntzo0Si2xXhyavstiTGqJJkxVpN W6yfNVH5QwTfoSdt4ul0m92d4yxnkyynaDkYk6WBK/7CzJKwPOd6+2k1hWsq5l3bKoiU 2NuNqaQ1HadFFqIhrr/4Vv2VS3fwoHljrqQ//5t9kxB1L8bYs4/NfY1SVRjNemm1LzqE l16V5M2u6QsbfnG+rPSf/Oa768CR7vy6QwmilF0DJIZohDJo3qjZODl3nC368DWI/4yj eSh+j0Gn4olzK638YYi92tucEHYdKBtEk8b+sTA29+QzpS1qJNvG3kFfkOq/wQfQ3anR Pnxw== MIME-Version: 1.0 X-Received: by 10.107.131.25 with SMTP id f25mr23225598iod.53.1435091049052; Tue, 23 Jun 2015 13:24:09 -0700 (PDT) In-Reply-To: <150623131706.ZM6164@torch.brasslantern.com> 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> <20150621210512.113577a6@ntlworld.com> <20150621213842.621886e0@ntlworld.com> <20150623174719.43eaa1e2@pwslap01u.europe.root.pri> <150623131706.ZM6164@torch.brasslantern.com> Date: Tue, 23 Jun 2015 22:24:08 +0200 Message-ID: Subject: Re: Typeset with array From: Mikael Magnusson To: Bart Schaefer Cc: "Zsh Hackers' List" Content-Type: text/plain; charset=UTF-8 On Tue, Jun 23, 2015 at 10:17 PM, Bart Schaefer wrote: > On Jun 23, 7:52pm, Mikael Magnusson wrote: > } > } This isn't really related to this series, but I noticed it now for the > } first time; what's the deal with the space at the end of associative > } arrays in typeset -p output? > > With a normal array, the number of elements is known, so you know when > you've reached the last one and can skip printing the space after it. > > When traversing a hash table, you don't know if you've reached the last > element until you've passed it; it's more straighforward to print out > ("%s %s ", key, value) for every element than to keep track of whether > you are past the first element but not yet at the last one. Ah, that makes sense. > If I were going to "fix" it for no reason other than the consistency, > I'd simply add MORE spaces rather than try to squash that one. > > typeset -a a > a=( b ) > typeset -A b > b=( b c ) This would also be consistent with xtrace output, so I agree :). -- Mikael Magnusson