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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32748 invoked from network); 16 Dec 2022 20:31:48 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 16 Dec 2022 20:31:48 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1671222708; b=COCLSqB7lO1qSIbFyXJKN9T4wjbaWNHHVccdydUgK7NxZKzxqhUvtx3kvsilU+N0s8enOS7lxR l43v/JI+orl94TmokklxSujYXJcSiwguRWJ0/+/oNsrMH3Rp/oZkhEaibOHgpvqwmnCCJaPqIm XTiYjq+of0F5SfvAZrDbhYZMF+buaii0eXOWKCUAbNOOm6jYV2fikfNBxIogB52kqXo16JZqMi zh2ACuNm7Caq3xmtLlkPRC8byjzH6MCRs9RFNwTt00pSliHMU3qs07yP1ghtX1xeagXuWyWSRP a7GNztXqMVsxKjXVWig6io9zhfPClEQSH73Ix9fH4Q6w+A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wout4-smtp.messagingengine.com) smtp.remote-ip=64.147.123.20; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1671222708; bh=oU2H3sm1uWsQ9zTtGTRaGOA1GhuiZi3sBKTI+SM9/Jo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:To:From:Date: References:In-Reply-To:Message-ID:MIME-Version:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=R+/JRRdlu0/yyzV/c1cox7RvHynuESDdvUPEBBqkNcLbAo+qJY6dJwrS2pOS1VfYvv9uHmbRvF TojhzYiDUs1spOz5hs1wiUkF2Q937xhXL80m+bI7bW/OxYzCi/vGTjivKd1yQmklvm7FKROWl2 /TKbgwz7iyoujW5KBMxFqZPxhShD2QA+IjrUKyOxK1276VtYWUdfbSikZDYJKpAzmXmsSTYdQo Lgl5fuvZE5LABMJBJ10HRPrOCM+2Ck9qPmqrtxtrJU1O2R/BDPRvLPA/XfX5lvxc7FTYIgEaRC iM2AX35swPL3W0AA6l6h/ZkYClS/C1G6wBzV+2wZ8WrMcg==; 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:Subject:To:From:Date:References:In-Reply-To:Message-Id: Mime-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=WP/j3EhH+ifKZWUI6/aLoavBVg52Ce9/P1A1yAp48qA=; b=oRes9O/q7x5uDT01EJhSC6eZD9 xU8/oVbHt9sp68+SlRUTv6lZXBrtJdDjMYs5c8VPPGkyVe6kKus557ME+7Qs5Hf4ZdfjMZa1mgm5z nJ5uzLreq9HKiyKW4WOL+o/tBLgt00vFV5nQLxJon8w94D3SFPe2XU8COxekQlrFB94HzcpsXEqmm tAP9JJVsQp/J7U3M9x8XuRT17zFY3gzSwCeMvwtYZgZkbcVwGQqaQNwc/bwqg0YkI7rcqvXzfq4u0 GYWxH9dqHAV/nRC89B3+rPjiXuJxLkCYzuhgXH8fHvmiPMvhh9fe0RUcY3vSSeVSucAngqusUiRzW Nl6ZftKA==; Received: by zero.zsh.org with local id 1p6HMx-0000bA-HG; Fri, 16 Dec 2022 20:31:47 +0000 Authentication-Results: zsh.org; iprev=pass (wout4-smtp.messagingengine.com) smtp.remote-ip=64.147.123.20; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:49695) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1p6HHd-000PkP-Qe; Fri, 16 Dec 2022 20:26:18 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id AA3843200950 for ; Fri, 16 Dec 2022 15:26:15 -0500 (EST) Received: from imap46 ([10.202.2.96]) by compute4.internal (MEProxy); Fri, 16 Dec 2022 15:26:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm1; t=1671222375; x=1671308775; bh=WP/j3EhH+ifKZWUI6/aLoavBV g52Ce9/P1A1yAp48qA=; b=GakyHyTT/YlKvNn99wmyZOfdD6M+WprRLf5Qpnjea zTDbZnz3w9bnrXMLJ2g34gfq2O2gwf6eM1xQWdLCGoh785MDnBqFDjNk3Oh8zKbo ByAa9zUaIAngTBHULI5B4LYZXKJLcv7MarKBkhu/ODeN+tjjdZ+g8bZo1HvVKWup 4AW9V2nFIh8kbQ4vX967jNJWuJyKT9JlsWtSUtwfdbPYJd7PUEmJkjpZiOx1wLVz v9IJzXvkJloc6u2EvbjyKgsr9+H396cckDxz/mtmlJ+2ne4Axyw1yfC7LgWyfAmM aJvO6bYZscu90Rn65k+PjR/pj1Wz9SxkF1fxTy42LngaA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1671222375; x=1671308775; bh=W P/j3EhH+ifKZWUI6/aLoavBVg52Ce9/P1A1yAp48qA=; b=varWwmqJ86YEF1ahs SahgXoiJO6ciJ2H6uXGVz+nDSPBxSTowol2eqNVI2GQzsohXIEpj+LeIYM/K6k0B gaziCiQHuk7wK51gTNJVQ2rce50RD9xjeTnbyPvlPGHZnyAg3zGq3ZoaQZJpU74v KKEek950GzaT5Ui9+zNu+Wekbn2RsAZRWEhOO6MI4bCHuoj/mrNCjzmhwfMlbEhq UNMU0O2z0jXDwKpgI/01ELww+ZDMXQkDokje+XAEmN35sFMrceyQlswEa0GG1VUo tNMYjK06oNVd/XkiQCqtFT1wZkYs8eXSYFyQQEUpDcJ5ND/UyCFQ7q9484wNk9mw ZGW+g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejgddufeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtgfesth hqredtreerjeenucfhrhhomhepfdffrghnihgvlhcuufhhrghhrghffdcuoegurdhssegu rghnihgvlhdrshhhrghhrghfrdhnrghmvgeqnecuggftrfgrthhtvghrnhepfefhkeefve eileelheeiffdtkedujeelvdfhtdejtdeggedvuefffeelhefhvdfgnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrd hshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i425e4195:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id E94292A20080; Fri, 16 Dec 2022 15:26:14 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1185-g841157300a-fm-20221208.002-g84115730 Mime-Version: 1.0 Message-Id: In-Reply-To: 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> <81952d4b-3ead-f912-f987-fe9a37dbd256@eastlink.ca> Date: Fri, 16 Dec 2022 20:25:54 +0000 From: "Daniel Shahaf" To: zsh-users@zsh.org Subject: Re: uninvited members of associative array Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 28565 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: Dominik Vogt wrote on Fri, 16 Dec 2022 19:04 +00:00: > On Fri, Dec 16, 2022 at 10:21:28AM -0800, Ray Andrews wrote: >> Yeah.=C2=A0 I'm sure many of my own travails have been due to that ki= nd 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.=C2=A0 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 po= nds >> with a 'positive option' mentality vs. the 'negative option' that we >> currently have.=C2=A0 Basically: If I want something I'll ask for it.= If I want a >> var to expand to filenames I'll request that. You mean that you wrote foo[bar] and didn't realize that was a globbing syntax too? zsh can't disable features because you don't know them. I suppose you could go ahead and disable all glob characters other than those you know, or perhaps you could propose a GLOB_VERIFY option akin to HIST_VERIFY. >> If I want empty elements >> removed from an array I'll say so. =C2=A0 As it is zsh loves to do he= lpful things >> whether you want them or not=C2=A0 and you have to ask for the exempt= ion.=C2=A0 Mostly >> by quoting but the world would have been simpler if it had been the o= ther >> way. Dunno, maybe not.=C2=A0 When one is dealing on the command line,= probably >> file-centrism makes sense.=C2=A0 But when it's variable contents the = opposite is >> true.=C2=A0 Anyway the thing is to learn the lesson early: quote. > > I think you have a grave misconception of shells. Shells are > basically command line interpreters with some text processing. A > command line is a string with shell specific instructions to > generate a final list of constant strings. These are then > interpreted as a command name and its arguments. There's no > conception of symbolic values; all input is just text. Shells are > are not "programming languages". The shell does not know about > file names on the command line, it just expands strings to > filenames if they contain globbing patterns. Yeah, the syntax rules are well-defined, but they aren't always intuitive. I don't know of any other language that does null elision on arrays, for instance: in most languages, if you loop over an array that contains ('foo' '' 'bar'), you get three iterations. In zsh you get two unless you specifically request three. In other words, the "default" syntax (the one with the fewest tokens) doesn't give the should-be-default behaviour.