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 30254 invoked from network); 18 Dec 2022 00:16:09 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 18 Dec 2022 00:16:09 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1671322569; b=XtfCwsyid6fhe5HVXywlvnKsoPGoa4aA9LgmFp6sehrqjT0YvhLVitUJSFsN9WlvWtCtCXtT/A 5BdIon6qdGpV09kyADVBA5qHiDBtgwwu2tPmqrMNRT+qUuLrC31U+hB09PTZk404LHvQUWN+j/ dLKKfhIE5oM1XoxdKEvkPXzuNS9EAMH93tGSm3Ye57XgUYCnu9GpZMmZK73c5Mrx5cGFCbUrd1 F0g+2aprMZsH5a7Qlgh4cFG+SlDBupgn6qibQk+aNDwomoAIHJqsqe4qLpMKGvzPvc/KCW05BP 1PEL6+gIos9LRwkiNjK7dGTkwUYlL8Uis6VS2PL89SFWXQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; 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=1671322569; bh=pJ7pTiXk7RKgZlTgVrDDKW6jbxqaPeeT5S8cxTnNyQc=; 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=h1OsadNz+G7Zs2gf1b3tYL2C6xfH6vrs6qz3uL8SePj8S4/cguTvU/0q6vKv+P3Wvr/zbIoTF2 Nc9vp9u+cBpFdRsVakqdkydVEo1iRhXmufXVWhdRT1uucFhBLpV2FhoTfFiLUgqUJSbjyNe5Aq Hp62cCiQUtNq7oj6ZtqSyxlHXz8MDUTiQLAO4By7kTrpn2osZFWwvAGjyFcewIrJfeEB0VKGVM e9EuSU7IeBgMEfnV9pk4/1rmvkjzDKFpisfSlRngaMOYTemRiu8Lyu0v1tGl5kYr75S896YszQ bixV/E13Zez8lR1ZwaTBUAT1r5HYR1AuQbOn2Vs994TP7A==; 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=8iCIwJ5PsHgNbj+xcCft1NNy0mPhuAIMBg+B+9UwvbA=; b=pVuQ79GiSDyTaf90t4lhjqdIdO VadZsTj313E1kaf9YTdxVLkE0B6LeEQG+YNtgyCEt98byQE6e+bbWolw7p449Wb9LMZVhEBTj/npI oAAw0VHmsXK5yrlJ/NAvg/hArilXZ3ojttMItQlYIer3OFWF1p0Y5HpbXcPfPA9ACMG5CYKL1U8// hj36J8v7Q5HasTElCP0ewOOLeN/EHeH/BPrI87PLweC++IVq3i0KHR7uuXNebq66OKNToHwQMJjNT tw99s3A1Qwpi3WFz6aEk7RaYqo2w0OIatd7LwIEkaBOxBbQF2t+C9qwShwAvOFbmfZAAZrNYYA92c uLMPxrIA==; Received: by zero.zsh.org with local id 1p6hLc-000Fp7-7Q; Sun, 18 Dec 2022 00:16:08 +0000 Authentication-Results: zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none Received: from mta02.eastlink.ca ([24.224.136.13]:33869) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1p6hL5-000F8w-OD; Sun, 18 Dec 2022 00:15:36 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta02.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0RN200KPD7H7XR70@mta02.eastlink.ca> for zsh-users@zsh.org; Sat, 17 Dec 2022 20:15:34 -0400 (AST) Received: from [192.168.0.4] ([24.207.18.108]) by Eastlink with ESMTPSA id 6hL3plCygEN8v6hL4pkyL3; Sat, 17 Dec 2022 20:15:34 -0400 X-Authority-Analysis: v=2.4 cv=IPDESCjG c=1 sm=1 tr=0 ts=639e5ba6 a=xN66ZtSbq5jdJYpBp7G/jQ==:117 a=xN66ZtSbq5jdJYpBp7G/jQ==:17 a=IkcTkHD0fZMA:10 a=qf68qge1Iaif5zBgTAkA:9 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedtgddulecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpeeitdejffevgfdtheeggfetkeeugeegieetuddtvddvudetteffvdevlefgueekudenucfkphepvdegrddvtdejrddukedruddtkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudekrddutdekpdhhvghloheplgduledvrdduieekrddtrdegngdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepvddprhgtphhtthhopeerredprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Message-id: <93583301-dbe4-673e-f8b0-b515d1e97c1d@eastlink.ca> Date: Sat, 17 Dec 2022 16:15:33 -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: <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> <27c7320e-7677-1268-3bf9-59939aad067e@eastlink.ca> <2c606231-ae9c-a7cc-8e35-e018ccead14e@eastlink.ca> <7a12a4c0-d423-4538-a194-18e9cf932fe9@app.fastmail.com> From: Ray Andrews In-reply-to: Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 8bit X-Seq: 28584 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-17 14:10, Bart Schaefer wrote: > The input doesn't have a type. It's the result of a substitution, so > it's just a series of separate words. Where the words came from is > not remembered. Consider: I suppose it could be looked at that way, OTOH it could be that the type is referenced.  After all the type *is* recorded.  typeset -p doesn't just cough up the contents, it knows that an AA should display differently than a normal array.  Since the type information is there, there's no reason why it might not be referred to. > > set -A thing new1 new2 "${(@kv)whatever}" new3 new4 > > What "type" is that? set -A IN "${(@Pkv)${1}}" # Copy the array to IN, the working copy. > Not fair.  In that case 'thing' is not assigned any type, so it's defaulting to a normal array is unavoidable.   But if I do: set -A IN "${(@Pkv)${1}}" .. and $1 names an array that typedef knows is an AA, then it wouldn't be very much work for IN to be matched with that type. It would avoid the gotcha that lead to my question.  Mind, as usual, once one is forewarned of the issue it's not hard to deal with.  As I mentioned, my case would rely on the precedent that that's the way it is with integer promotion.  Good thing too, because doing arithmetic on a scalar is slightly absurd. Note the importance even then of knowing the type being assigned-to, which is > exactly why you have to declare it before calling "set -A". Well it's simple and hopefully failsafe, but I still  can't help but thinking that if typedef knows the type of the input then the type of the output could be assigned as well as the values. Daniel: > Could someone please clarify this in the manual? Thanks. It makes me feel less stupid when someone agrees with me that the manual isn't as clear as it could be. The manual was written by someone too intelligent for the job -- no empathy for the less gifted. >