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=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 28772 invoked from network); 22 May 2023 21:02:49 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 22 May 2023 21:02:49 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1684789369; b=EkZ2vRyo4xzfaj+AX3qryNplxo4VbmwWz3laEQCjpKpTomWuD5BymeaAeJ5MCq7bizmGWP8k2z 8jP8sFqr/PdR0ygwxI9IGY751tfyWY2XLzVA0JqIy5Nsu6LHUBvmtZ8Ksbnbzptw9HRnGfmgJy RfMbDoGNw6/pBuvnWOYs9tkVDGBUlkWlrjdrD51fNOBj96al5MkRuqp4LOnVfCKZ4tjPu+zWJ4 xC+NdNQAG2KFBDUowPVx0SKKoLyTwcvVudJzKyqNzGC3kr64BjgO/14kw02gYrhCEA8kKvbLdL YxCD4rPpaADiHoYlLuMz9HpbwphNbQputEyhcJ8HTivCEw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mx.spodhuis.org) smtp.remote-ip=94.142.241.89; dkim=pass header.d=spodhuis.org header.s=d202305e2 header.a=ed25519-sha256; dkim=pass header.d=spodhuis.org header.s=d202305 header.a=rsa-sha256; dmarc=pass header.from=spodhuis.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1684789369; bh=xMA04kIRIYpOwVQgka8fPoCg0fiDPerPto9Qo3vR3iM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:To:From:Date:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=hHy6FCA7GwE1yuHoJyLOMuEAIbzAuSom/tIUrELmiQ1Cdt1gyLK93VT9MfM0VYxtZBvk54VxEv qUKff9DjFhWfG5ucH+RCfT/4QXAst7aozG3GFg+kOqDN6TGqd7RGv1JALOIyXol1PSShT0fXKV iuJpPXeVOvXql1CYZbSLa1PX6eK7KOm/xwOJrE1DtwmpLCrI+IFjQwTGSmt97i4lgMicRnWvEJ ofmeHCfLxP+nF94bMYjN2mHiuGETnENiKQwTti9ck51Gno3Bc3YX9IoTfapeulcG/sg+SPtKpp FpWcQeUSQ1LTkZXdPpN2vT0JpG8VbFd93gWOs/pHpjbGoQ==; 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:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=JvmTmjxwwfinHOzCZGsyCNecxbhvA+ruzEI8MSBUozg=; b=j4fsS+1PAjNj2JVk/xg/1Z6gAX nlgZs0bRYB+OQTAJFEjzT3L1VYVoytqdwvs/L12Bk96cS0XP7OlGr/m76568ZjymlzvwUQLjfRu0e wxBwOJk+IyNuhb4OJ5mpvZMYvDsaI6VTMNKazsSbHIki2E4mgqhqHMQEjvU/6YALcbRfAsCf+7eND 4nxRLeSd4JUsg350m7atfqXr3yZdcx7cU5CuoGkFi2pm+WLwzxfFSN7Kxd4UjevynWByOD5O8bkI1 lTqdc47WFxFyDDjKKssyXasaWGrk85YW9HToZU8ye9n6ADJdpiLaFiWngNzX1BUM2o0Sfdbq2sS3C gow7IgNQ==; Received: by zero.zsh.org with local id 1q1Cg3-000Njo-Rq; Mon, 22 May 2023 21:02:48 +0000 Authentication-Results: zsh.org; iprev=pass (mx.spodhuis.org) smtp.remote-ip=94.142.241.89; dkim=pass header.d=spodhuis.org header.s=d202305e2 header.a=ed25519-sha256; dkim=pass header.d=spodhuis.org header.s=d202305 header.a=rsa-sha256; dmarc=pass header.from=spodhuis.org; arc=none Received: from mx.spodhuis.org ([94.142.241.89]:60055) (DNSSEC AD) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1q1CfW-000NQF-LK; Mon, 22 May 2023 21:02:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202305; h=OpenPGP:In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date:From: Reply-To:Subject:Date:To:Cc:Content-ID:Content-Description:OpenPGP: Organization:Auto-Submitted; bh=JvmTmjxwwfinHOzCZGsyCNecxbhvA+ruzEI8MSBUozg=; t=1684789334; x=1685998934; b=JJuhAZkf1Paa8+SBo2Oy8vzylAGBmmK3xO/2l83/gymT9C6 lM3w7OiFumfs739aiaTH6s6gAqFejFkp45pupstuVgSDEorUHaGQ1H2iTjUxmsIkwpBlPj1Y38WuU vIEn86it2JVKmeMXesA7jyopsbbt0PNwJKA5JuGfdhtBIEZSnfhGv6Hu/xyIBxwiLjxWdRGhph1Wa oVqxtQLAFgNDUpQ73kiI/UFPlHcDh4IVbJJ2RswARNdW+4j0X8zdSRqhB+DHSe0XmJUdwGV9uRvqI YgPsqHkZpdMxJEFUVPUUXnCvlAp9oPXUiqwEiknUrJxK/bbfNNV9+WeIX5tqPyIw==; DKIM-Signature: v=1; a=ed25519-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202305e2; h=OpenPGP:In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date:From: Reply-To:Subject:Date:To:Cc:Content-ID:Content-Description:OpenPGP: Organization:Auto-Submitted; bh=JvmTmjxwwfinHOzCZGsyCNecxbhvA+ruzEI8MSBUozg=; t=1684789334; x=1685998934; b=oYM2dA9tcOLzk27yl08SzE3y9ndY3jbgbRgn+jOhYp9+TCg OyBaLuF0oNQDFcYrdue4Zn+Bbf7y5LBkT6ckbAg==; Received: from authenticated user by smtp.spodhuis.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1q1CfV-000NQ9-31; Mon, 22 May 2023 21:02:13 +0000 Date: Mon, 22 May 2023 17:02:11 -0400 From: Phil Pennock To: zsh-workers@zsh.org Subject: Re: [PATCH 1/3] Extended ksh compatibility: namespace parameter syntax Message-ID: Mail-Followup-To: zsh-workers@zsh.org References: <26170-1678007435.186071@mDq6.Euc0.bAwZ> <52850-1678055097.553101@HAUa.4aGe.fmcC> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: OpenPGP: url=https://www.security.spodhuis.org/PGP/keys/keys-2013rsa-2020cv25519.asc X-Seq: 51775 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On 2023-05-21 at 21:35 -0700, Bart Schaefer wrote: > On Sun, May 21, 2023 at 7:36 PM Mikael Magnusson wrote: > > > So, to match the intent of ksh as I understand it: > > > * .identifier.x is always treating identifier as a namespace > > > * identifier.x is always treating identifier as a compound var > > > * this is consistent across assignment LHS and expansion > > > > Does this mean compound vars can't be namespaced? > > No, but it does mean namespaces can't be nested. Bart is (as per 99.9% of the time) correct. The examples below might make it clearer (and are original to me so fine to grab into the test suite). Note though that ksh does have nested collection types, which would make full zsh compatibility trickier: Attributes assigned by the typeset special built-in command ap‐ ply to all elements of the array. An array element can be a simple variable, a compound variable or an array variable. An element of an indexed array can be either an indexed array or an associative array. An element of an associative array can also be either. To refer to an array element that is part of an array element, concatenate the subscript in brackets. For example, to refer to the foobar element of an associative array that is defined as the third element of the indexed array, use ${vname[3][foobar]} $ namespace foo { bar=(alpha=one beta=two gamma=three); } $ echo ${.foo.bar.alpha} one $ $ namespace first { namespace second { item=42; } } $ echo ${.second.item} 42 $ echo ${.first.second.item} $ typeset -p [ ... skipping much before/after/between these ... ] namespace first { : } namespace foo { typeset -C bar=() } namespace second { item=42 } $ namespace a { b=( c=(one two three) d=([ichi]=1 [ni]=2 [san]=3) ); } $ echo ${.a.b.c[@]} one two three $ echo ${!.a.b.d[@]} ichi ni san $ echo ${.a.b.d[@]} 1 2 3 $ echo ${.a.b.d[ni]} 2 $ -Phil