From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14896 invoked from network); 16 Dec 2022 18:22:11 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 16 Dec 2022 18:22:11 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1671214931; b=gMEMBaOkRsyU6PTDixwRJmbpGu2RxrgqLA6dPvPJW/FRDaIcjCqtQoduxsW5exsmnZGOBQWC/0 8fL8TivheeqK+phIRa8Uuvs1AGf+Gxy1H1wtjLWtk5RdUBpx8epPkGts9j40oJOKFB8hptqnZL QGT9FLav6stnm73+gAA+tnCdGtH3vY/Y81J6VbKyAesjjwrWEnu1+395uxhXgb7nTT8ZiA3UTq 23TfIe43MvTgKdDcOYzNQCoTja7rkhfIdug7XPy6kfs76wV0IExHzt/ZSmtS85sUp6/VyUCC62 DJ2KC5l0odiTX7B6a+Qr3dCZ4BZy/Z68+BnZvlB09vdBRQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1671214931; bh=J6eDamCKd/Cr1kQu8tSE6R9N6/NG6CE1ByueGYTGIv8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:DKIM-Signature; b=sDjdlSpkDbnwQycw0Qgl5ZvzADHJfvNnGhJxjAMQs4FjDs1PRgY3bYyoyv8fzmNg6LRteOycWY 7whL7PJ9mGIrTj6MwChzvaAMk2+ntwalGBfxt1/DTW12VKLejQCsSzJDmYwfzppKTvf/PrL92N Wx2XtgbDSc92WJ/UJ/89W/wc3Oj0G9YAgMmuS4I9y8yFWA1OVW8ex+ZcNFcnPZOnCIl7zRBUjU 2K84gG+o0cs1XULntrYqr5OHJo0BW5tKfERPc6Q2p56ld9WNdn2oSHyaC0kTP7Ir5qTAuhtcdI Oo1bobBKWZPxTpTmV/yw+n9YHN2HGlwX6TwXE9kLg8TOZQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-transfer-encoding: Content-type:In-reply-to:From:References:To:Subject:MIME-version:Date: Message-id:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=xTeL+0m4QCVwvz5J92Gmm5UKj/5yo0gY5kEP7qXC/AY=; b=aNAUIk7YD1/+VUT1dGAeVfWUsj LskxXLmc4VgHhxg77+T2D4Fcre/KSw9wgqCwHttptlhxELsramxcy2r/iuzToi1trdZZAvz/bPOhp KGW0GBOxk0/nyzvRF0eMYtUmYE5aFW378kD+0CQN9RJDugLFu1ZAReJOf9sk3jbkNd34uExIG7AUT 85GWrRf6a8CBwlFCw0AnNFQEsFSypqdwsKhqEWnH9vrfk/Y94vMNUadEIv+l0TQwB15xaHVgxMng6 r8YU1ZBWOZ004mmno9yiff5jBAHaY3RrDLcPa5wBecqGwx1V5M4j86woUC1unaCCrxNaCvXpfx555 DKpHjpDw==; Received: by zero.zsh.org with local id 1p6FLX-000Hhs-B9; Fri, 16 Dec 2022 18:22:11 +0000 Authentication-Results: zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; dmarc=none header.from=eastlink.ca; arc=none Received: from mta03.eastlink.ca ([24.224.136.9]:44404) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1p6FKt-000H3M-2N; Fri, 16 Dec 2022 18:21:31 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta03.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0RMZ00IK4TZWMM60@mta03.eastlink.ca> for zsh-users@zsh.org; Fri, 16 Dec 2022 14:21:29 -0400 (AST) Received: from [192.168.0.4] ([24.207.18.108]) by Eastlink with ESMTPSA id 6FKrphWCWEN8v6FKrpkPMe; Fri, 16 Dec 2022 14:21:29 -0400 X-Authority-Analysis: v=2.4 cv=IPDESCjG c=1 sm=1 tr=0 ts=639cb729 a=xN66ZtSbq5jdJYpBp7G/jQ==:117 a=xN66ZtSbq5jdJYpBp7G/jQ==:17 a=IkcTkHD0fZMA:10 a=C3Ie2RSL68Szk7lIUTwA:9 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejgdduuddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomheptfgrhicutehnughrvgifshcuoehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgeqnecuggftrfgrthhtvghrnhepiedtjeffvefgtdehgefgteekueeggeeitedutddvvdduteetffdvveelgfeukedunecukfhppedvgedrvddtjedrudekrddutdeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrddukedruddtkedphhgvlhhopegludelvddrudeikedrtddrgegnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepreerpdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Message-id: <81952d4b-3ead-f912-f987-fe9a37dbd256@eastlink.ca> Date: Fri, 16 Dec 2022 10:21:28 -0800 MIME-version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: uninvited members of associative array Content-language: en-US To: zsh-users@zsh.org References: <0c2b1f8f-35bb-cd52-3d22-0964a73945b2@eastlink.ca> <46161d8a-c177-4134-836e-592e5c048887@app.fastmail.com> <902fb047-3435-89a3-e7ea-74e74075c2c6@eastlink.ca> <09d09690-08c8-4499-9011-9c45d7676f52@app.fastmail.com> From: Ray Andrews In-reply-to: <09d09690-08c8-4499-9011-9c45d7676f52@app.fastmail.com> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 8bit X-Seq: 28561 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On 2022-12-16 08:30, Daniel Shahaf wrote: > I think the better takeaway here is that the "default" (barest) syntax > isn't always the right one. There's any number of examples of this: > > - Variable expansions, «${foo}». Scalars need to be quoted; arrays need > to be quoted and @'d; assocs need to be quoted, @'d, and (kv)'d. The > actual meaning of unquoted «${foo}» — expand to all non-null values — > isn't commonly needed. > > - «ls *.txt» without a «--» guard. > > - «print -- $foo» without «-r». > Yeah.  I'm sure many of my own travails have been due to that kind of ... well, one could say 'shortcutting', but more often it's simply not understanding the vulnerability of unquoted vars. As a few weeks ago, when what was it ... something unquoted with '[]' in it tried to expand to a list of files.  It's far to late to do anything about it design wise, but if it were up to me the shells would have evolved from their warm little ponds with a 'positive option' mentality vs. the 'negative option' that we currently have.  Basically: If I want something I'll ask for it. If I want a var to expand to filenames I'll request that.  If I want empty elements removed from an array I'll say so.   As it is zsh loves to do helpful things whether you want them or not  and you have to ask for the exemption.  Mostly by quoting but the world would have been simpler if it had been the other way. Dunno, maybe not.  When one is dealing on the command line, probably file-centrism makes sense.  But when it's variable contents the opposite is true.  Anyway the thing is to learn the lesson early: quote.