zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Budi <budikusasi@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: How to have function local variable but must behave just a simple one
Date: Sat, 26 Aug 2023 13:26:21 -0700	[thread overview]
Message-ID: <CAH+w=7YM0dFNLKJo1E1w29zHCfv909gGvRCAd=LqUcqWcaHTWA@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMr9UjvPAJNRW8i6xviCwy-aLTb+oKoO3Y+Y-wnYzGLc7w@mail.gmail.com>

On Sat, Aug 26, 2023 at 12:34 AM Roman Perepelitsa
<roman.perepelitsa@gmail.com> wrote:
>
> Zsh doesn't have the equivalent. You'll have to use a global parameter.

More generically speaking, shells typically use dynamic scoping rather
than lexical scoping, which means a variable only persists until the
scope where it is declared finishes, and while it persists it is
available to all deeper scopes.  The zsh/param/private module changes
some of the availability rules, but nothing changes the persistence.


  reply	other threads:[~2023-08-26 20:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-26  7:25 Budi
2023-08-26  7:34 ` Roman Perepelitsa
2023-08-26 20:26   ` Bart Schaefer [this message]
2023-08-26 20:38     ` Ray Andrews
2023-08-26 20:58       ` Roman Perepelitsa
2023-08-26 21:10         ` Ray Andrews
2023-08-26 21:13           ` Roman Perepelitsa
2023-08-27  0:50           ` Budi

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=7YM0dFNLKJo1E1w29zHCfv909gGvRCAd=LqUcqWcaHTWA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=budikusasi@gmail.com \
    --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).