From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id EAA6B23E46 for ; Sun, 14 Apr 2024 16:59:53 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1713106793; b=GlTZ2U7AxuhLmlig5dMKGB1Xfj6m3/Dg+Ve1etVBflXbg+L7Pq8NOQzRe7jUmr8QhayVQELbtb lq6swrf1K9l522Q7Wy8Qt985tMOXiLDxLiZwDeHMp1eWxQDk1MJcWdH27CmX8yf6v+xRnB0+Rx lCOprTwk5QrU7HJ/lNE31JSynlVjmMiHliKo2/+T4+uSbcSSNMpnoKpD2H4eTRpjbiMbH65Dkt EAg5b/GeHM8sTPnNPgqVjrf1U1QfWyJlsOtu0+d16KwN4dUXVjkDlTRI/zESleYo6pByoKCyCF fEx69VY8i9bXfQWP+otnoyd9drWpVSz2m8RqF7j4r1Q3KA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f180.google.com) smtp.remote-ip=209.85.208.180; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1713106793; bh=9vafrMVVCN7p7pqNC9VxCr1VgyQdtWxNrSFry8ctSws=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Mq5L5HBZ635McqYO0/l1UerkP32KhHiCkb5y5hhHs9jn87EWFfIiUPBBTTiaIbGh0pNNLBKgqB ZIz2U7xBvGkOunuhzfXbNoj7FyhyHNLaw8LGP0i0KbCscuXsMen/7NWXYk3YCOk63/qqaKnc0x TgrP+55bAERIrChL+Sw1YE8aHJyiesAoiRMfYu2oY/FZa2OkpITqa49Qq9e2PwHwTfa3WAsWBW x+Z6rgzRsfVWut8iRdX9M5ep0bgmOyGJG2iDSIqmbxdM12ZqdbErx0240F2noZZQd6Wx/Nhxp+ oToySSOoYH2y73Y3FG011lQ0PAttcibmGkIPUMe1zmx9Dw==; 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-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Tj3wiyODD1GmUHHWauJgXipilzREckxacymjzlWnVI4=; b=GUhHc2Rkcj3A/1D8Ad/rNb5zL+ DCushEeymG/S63QqSBW7DB6VqPQu7+PNmng0RXz5uL23holqSPAasoyxZ9kkTz72cJ5L2qtFC1dub YBX6j6VMSNIbcNq8kaA4hS7SSira6l5Io2bRwFREyXhqCuuIwcdZgKgYvmk5ljFDxzzyTmO8ixc3F jQHlTcNdDBjIPIEreRWzuyzByhnkWyt/yEM45gGGzS5/BJGOPtET+vtA25Zx8ADCLdmJwpMx0oOqa okhy+nalpwjsant+/QVPcpav3E8f85fxFdTaUUWsc44ZHOYorNyAkAfERi9hz544RGAVPvZCE92GC MMVZKJaQ==; Received: by zero.zsh.org with local id 1rw1Kj-000LkS-EC; Sun, 14 Apr 2024 14:59:53 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f180.google.com) smtp.remote-ip=209.85.208.180; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f180.google.com ([209.85.208.180]:54637) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rw1K6-000Kyn-Bc; Sun, 14 Apr 2024 14:59:15 +0000 Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2da0b3f7ad3so25306381fa.1 for ; Sun, 14 Apr 2024 07:59:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713106753; x=1713711553; darn=zsh.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Tj3wiyODD1GmUHHWauJgXipilzREckxacymjzlWnVI4=; b=lzPnvpw/FPjkb5EU0PqQUrJBwEYFpfgvKaGzE3xGnTps5CrNUWWdotXnPN6xR3WlFi uu7NiAK5T9b60DjDjVBHs2pI22rOtPy0X8+4W6Ekd2ik5Dc8jpJFKbB53jBKKt/m+Ue6 yVhCTpOCocKvajB1bjfdVAXguAicDBJxAnIuIqJfBHYtigOl30ARladh1Nk0cMnr+cc6 OtHnJNpnASfH03AtjMq/Q+6IcxOSoMDSn4XLNrdPBQcHzxRmNyt0mSlEa73XlcQPC8Bt MwcDZQ+miainI2AP7hPoBtgifFnjA0lF3//jiei6BhMQiuisEYfPRD1N5w1BCvlaEpPT EvDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713106753; x=1713711553; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Tj3wiyODD1GmUHHWauJgXipilzREckxacymjzlWnVI4=; b=PMYgDuzsTObL50xI9nWJGzq0nv80GRakU2a9wuup1f1Mw+YOG63qsNnAT1Sy1eVYmE ysP8HWuRr6pnUdKLW67orViiHd0Gg01Obv6ei3tQldRS/myY/jmIkGeTlZy8y+6ryEHn mvWUgO9W87NnuCU+vsmpGePEtdxk271wjnSBeliju8spRnalAhJbLe1a0oysL6ZS91/O J/bTt5rSJfq1LZZnYsiP0S7bcSByVbf+mvN2UhNQkKlvyg8ajcku9e4nkkZP7fZdgjCo GeqrY17CfcwJagTn1dQaAgKt88AMb3pbyIOZ5UgrrgfXHUehiE+uNv1jmqK6QdM4xPte +4dA== X-Gm-Message-State: AOJu0YzuZhvOJGBwTtOqKS9ZWvgQ16qSXrVHuLPHF9QSPszGSHddL9W1 q2HaLpfgbLZI8T+YPLIIf2raVAsyTpyWgYJ0cE47bw59mWiSxBn0VWoeGqp8+Qp6k6Oox9vLm+8 DYCOFDOaPhhlLzf1ukuTowMtfLuk= X-Google-Smtp-Source: AGHT+IFZnszGNLq+h2qjTMowy/L6Sns3OQjkrcUm1/67ZzfhI3t6vQ1/TIH/2Asyu5DtDUNG9Zh39N20kKBGCupCRVg= X-Received: by 2002:a05:651c:11d4:b0:2d8:6e1c:3512 with SMTP id z20-20020a05651c11d400b002d86e1c3512mr4236252ljo.53.1713106753431; Sun, 14 Apr 2024 07:59:13 -0700 (PDT) MIME-Version: 1.0 References: <97793422-1543-4ba6-b52b-ff93eba03ab1@eastlink.ca> <1e53a3f7-9bdb-45ae-81c7-7d0ec1a6a541@app.fastmail.com> <3cc19e86-e953-4e2f-9e57-30ff84f15fdf@eastlink.ca> <0a0b9ec3-4661-4386-9fbf-b3152a46001e@eastlink.ca> <9416dc0a-3e41-4229-a9e1-239411ab3c17@eastlink.ca> <4a1e027c-a9d8-4306-bf3b-e1282914644c@app.fastmail.com> <4e9aa98c-9b5d-4e22-b7fc-8c50a9af9ada@eastlink.ca> <2a3cc24f-f006-4889-aaaa-2715b8b1d7cd@eastlink.ca> In-Reply-To: <2a3cc24f-f006-4889-aaaa-2715b8b1d7cd@eastlink.ca> From: "Mark J. Reed" Date: Sun, 14 Apr 2024 10:59:00 -0400 Message-ID: Subject: Re: triviality regarding $# counts To: Ray Andrews Cc: zsh-users@zsh.org Content-Type: multipart/alternative; boundary="000000000000802f1506160fbfe6" X-Seq: 29825 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: --000000000000802f1506160fbfe6 Content-Type: text/plain; charset="UTF-8" On Sun, Apr 14, 2024 at 10:48 Ray Andrews wrote: > > > > > % hhh=( "${(@f)iii}" ) > % typeset -p hhh; typeset -p iii > typeset -a hhh=( 'abc\ndef\nghi' ) > typeset iii='abc\ndef\nghi' > > ... newlines still there. One element. > No newlines nowhere! You've got backslashes and n's, but nary a newline to be found. Which is the only reason (f) isn't completely mucking things up. See my last message. BTW, just philosophically speaking, the parens are an interesting > question. Whereas I'd say that a copy is a copy is a copy: > > aaa=$bbb > > ... so whatever bbb may happen to be, aaa will become the same. But if > aaa is a scalar, should it be promoted 'silently' ? Seems to me the parens > are explicit that aaa will become an array so I like them. One can never > be too clear as to what's happening. > The parens are needed because of the way assignment works. At least conceptually (though the implementation may optimize), the right hand side is first expanded, and then the result of that expansion, treated as a literal value, is what gets assigned. The shell doesn't just copy the innards of the variable value from one spot in its symbol table to another; it takes a detour through first expanding the value and then doing some subset of its normal parsing on that expanded value. --000000000000802f1506160fbfe6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sun, Apr 14, 2024 at 10:48 Ray Andrews <rayandrews@eastlink.ca> wrote:
=20 =20 =20




% hhh=3D( "${(@f)iii}" )
% typeset -p hhh; typeset -p iii
typeset -a hhh=3D( 'abc\ndef\nghi' )
typeset iii=3D'abc\ndef\nghi'

... newlines still there.=C2=A0 One element.

No newlines nowhere! You've got b= ackslashes and n's, but nary a newline to be found. Which is the only r= eason (f) isn't completely mucking things up. See my last message.

BTW, just p= hilosophically speaking, the parens are an interesting question.=C2=A0 Whereas I'd say that a copy is a copy is a copy:
aaa=3D$bbb

... so whatever bbb may happen to be, aaa will become the same.=C2=A0 B= ut if aaa is a scalar, should it be promoted 'silently' ?=C2=A0 Se= ems to me the parens are explicit that aaa will become an array so I like them.=C2=A0 One can never be too clear as to what's happening.=C2= =A0

The par= ens are needed because of the way assignment works. At least conceptually (= though the implementation may optimize), the right hand side is first expan= ded, and then the result of that expansion, treated as a literal value, is = what gets assigned. The shell doesn't just copy the innards of the vari= able value from one spot in its symbol table to another; it takes a detour = through first =C2=A0expanding the value and then doing some subset of its n= ormal parsing on that expanded value.
--000000000000802f1506160fbfe6--