zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Jun T <takimoto-j@kba.biglobe.ne.jp>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH] Document ${(!)refname}
Date: Mon, 10 Jul 2023 18:21:59 -0700	[thread overview]
Message-ID: <CAH+w=7a3bz1APBBD3WMh9wpd73zaChHOGUjCSKrOmg9+GEMgTQ@mail.gmail.com> (raw)
In-Reply-To: <1F241427-C6DE-496E-856F-8C900AA576BB@kba.biglobe.ne.jp>

On Thu, Jul 6, 2023 at 11:45 PM Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:
>
> % typeset -n ptr=var
> % echo $(\!t)ptr}
> nameref
>
> Probably something like the following,
> "When the parameter being expanded is a named reference, do not
> resolve to its referent but use its own value."
>
> At the end of the subsection "Named References" in zshexpn(1)
> (expn.yo:1614), there is a description of ${(t)ptr}.
> How about adding a description of $(!t)ptr} here?

Perhaps this?

diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 7bc736470..4285aa4c1 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -987,6 +987,11 @@ means the same thing

 startitem()
+item(tt(!))(
+When the parameter being expanded is a named reference, the reference
+itself is examined and thus is em(not) resolved to its referent.  In
+ksh emulation, the parens around this flag are optional.
+)
 item(tt(#))(
 Evaluate the resulting words as numeric expressions and interpret
 these as character codes.  Output the corresponding characters.  Note
@@ -1245,7 +1250,8 @@ item(tt(hideval))(
 for parameters with the `hideval' flag (tt(-H))
 )
 item(tt(nameref))(
-for named references having an empty value (tt(-n))
+for named references either having an empty value (tt(-n)) or when combined
+with `tt(!)' as in `tt(${LPAR()!t)tt(RPAR()var(rname)})'
 )
 item(tt(special))(
 for special parameters defined by the shell


  reply	other threads:[~2023-07-11  1:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22 21:39 Bart Schaefer
2023-07-07  6:45 ` Jun T
2023-07-11  1:21   ` Bart Schaefer [this message]
2023-07-11  1:37     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7a3bz1APBBD3WMh9wpd73zaChHOGUjCSKrOmg9+GEMgTQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).