zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Documenting $(( foo )) as similar to $(( ($foo) ))
Date: Fri, 16 Feb 2024 09:40:55 -0800	[thread overview]
Message-ID: <CAH+w=7atjL5ZgNeXSO4ROJq2xkV8TTn-1yw3WKj5aDRH6MgDkw@mail.gmail.com> (raw)
In-Reply-To: <c71935ff-91ef-427d-9bee-472b99bb14b4@app.fastmail.com>

On Thu, Feb 15, 2024 at 9:46 PM Lawrence Velázquez <larryv@zsh.org> wrote:
>
> I just noticed that Bart added the following text to zshmisc(1):
>
>         If the expansion of $val1 is text rather than a number,
>         then when val1 is referenced that text is itself evaluated
>         as a math expression as if surrounded by parentheses
>         `($val1)'.
>
> I assumed that Mikael's comparison of foo with ($foo) was meant to
> be an analogy, so I didn't nitpick it at the time, but I worry that
> this addition to the documentation could be misconstrued

It was my hope/expectation that "as if" would be adequate there.  Note
that in that paragraph we're talking about how val1 works WITHOUT a $
prefix whereas here here you have it WITH a $ prefix:

> ...just because this is valid (if ill-advised):
>
>         % print $((($foo)))
>         3

The latter is only "valid" because of order-of-operations effects, the
inner $foo is expanded before the outer $(( )).

If you can suggest a better way to express "expansion of $val1 is
text" please do.  I rejected "the value of val1" because prior
sentences already refer to "the value" as the result after arithmetic
occurs whereas here we want to refer to the string before arithmetic.


      reply	other threads:[~2024-02-16 17:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4c14e191-0605-4492-9f67-9a5b35ef132b@eastlink.ca>
     [not found] ` <4da0eeb4-4589-4c5d-9b89-a1a22209e18e@eastlink.ca>
     [not found]   ` <CAH+w=7an4ZbDfNxnNkOw-DE07jqarcLXdGg1Tk=uDi_0ZHnY0Q@mail.gmail.com>
     [not found]     ` <CAH+w=7Y6iYdLw-BKepmQVbEKj9d_VLXkq4zWugGpEj1siCt9RA@mail.gmail.com>
     [not found]       ` <7ccf5b82-a37d-47b5-a700-fb1096ab495c@eastlink.ca>
     [not found]         ` <0875ffd7-e3a4-4ddc-9c4b-47e2c593ea4c@eastlink.ca>
     [not found]           ` <CAH+w=7aznm0sBRqz4=Mo4q86oMzKrg0ktSEtFBGQupiWSV7WEg@mail.gmail.com>
     [not found]             ` <f228c732-d237-4597-b260-b28da72fd84b@eastlink.ca>
     [not found]               ` <ecf249c0-3787-463d-bc30-1440fc6b1510@app.fastmail.com>
     [not found]                 ` <ec856c16-59c3-4967-b309-cb0da750354b@eastlink.ca>
     [not found]                   ` <1745fff9-822c-499f-b60e-7248e95438c5@app.fastmail.com>
     [not found]                     ` <CAH+w=7ayzF1D7N-n-bs9y3_zyiYb7WCTnJgg9B8ER7j+fXVdaw@mail.gmail.com>
     [not found]                       ` <CAHYJk3SWzLZnzaHvt109Go46G8LQ0Qb1QBQR8CDn5mbDQGVhdA@mail.gmail.com>
2024-02-16  5:45                         ` Lawrence Velázquez
2024-02-16 17:40                           ` Bart Schaefer [this message]

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=7atjL5ZgNeXSO4ROJq2xkV8TTn-1yw3WKj5aDRH6MgDkw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --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).