From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: unexpected unmodified variable
Date: Fri, 7 Oct 2022 14:59:07 -0700 [thread overview]
Message-ID: <7731f988-7537-3a64-0fef-87848d656ca8@eastlink.ca> (raw)
In-Reply-To: <CAH+w=7ZFQw+mkXKv9TPPB5=SkPx3eOWOxwjAuUWas8VeNbfUgQ@mail.gmail.com>
On 2022-10-07 13:00, Bart Schaefer wrote:
> ... which might just be the most impenetrable bit of computer
> bafflegab I've ever read, I can't get past the first sentence.
> Seriously? This is all using phrases that refer to concepts appearing
> elsewhere throughout the zsh manual.
True ... which makes the manual hard to understand. It's a language
unto itself. What would be helpful is some sort of introduction to
zsh-speak. Mind, I expect all the shells have about the same jargon.
But believe me, when you don't know the lingo it's impenetrable.
>
> Oh. Given the way you wrote func2, if you remove the return statement
> there are NO math expressions in func2 at all, so $(( func2() )) is
> [except for side-effects] a no-op, and the assignment in var=$((
> func2() )) is just skipped, leaving the previous value of $var
> unchanged.
Ah! ... yes, why would it change? nothing has touched it. I was
expecting func2 to somehow cough up a null value setting 'var=0' but
it's not illogical that it coughs up ... nothing ... therefore there is
no assignment and 'var' does not change. I get it.
> "Local" text substitution is what ordinary $param references are for
> ... $(...) specifically means to use processes and pipes. That said,
> a still-missing feature in zsh is the ability to tie a function to a
> variable so that referencing the variable as $foo invokes the function
> that's tied to it, to produce the effect you're asking for. Ksh has a
> syntax for that.
>
Well you'd know. Anyway as usual the functionality I was looking for is
there even if it didn't look like I expected. By now I should have a
permanent understanding of this stuff not keep relapsing.
prev parent reply other threads:[~2022-10-07 21:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-06 19:07 Ray Andrews
2022-10-06 19:28 ` Peter Stephenson
2022-10-06 21:58 ` Ray Andrews
2022-10-07 0:36 ` Bart Schaefer
2022-10-07 1:37 ` Ray Andrews
2022-10-07 4:36 ` Bart Schaefer
2022-10-07 15:28 ` Ray Andrews
2022-10-07 20:00 ` Bart Schaefer
2022-10-07 21:59 ` Ray Andrews [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=7731f988-7537-3a64-0fef-87848d656ca8@eastlink.ca \
--to=rayandrews@eastlink.ca \
--cc=zsh-users@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).