zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: new user questions and issues
Date: Mon, 11 May 2015 19:43:56 -0700	[thread overview]
Message-ID: <150511194356.ZM12934@torch.brasslantern.com> (raw)
In-Reply-To: <D71D4785-878D-47C4-832F-04ED2C9FEBCC@gmail.com>

On May 11, 10:43am, Kannan Varadhan wrote:
}
} What I really desire is that the variable not be inherited by or
} visible to any called functions.

That's pretty much never going to work.  The shell parameter space uses
dynamic scoping starting from the process environment on down; a scope
can explicitly replace a name from its surrounding scope, but can't
conceal that name from scopes upon which it calls.

In fact because shell functions can only accept arguments and can only
return exit status, dynamically scoped variables are the only way to
share data from a called function.  (Except stdin and stdout, of course,
but then you're dealing with separate processes, not merely scopes.)

Yes, ksh plays some games with this by allowing a nameref to be passed
as an argument.


      reply	other threads:[~2015-05-12  2:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 17:37 Kannan Varadhan
2015-05-06 20:50 ` Eric Cook
2015-05-07 21:46   ` Kannan Varadhan
2015-05-07 21:54     ` ZyX
2015-05-11  5:02 ` Bart Schaefer
2015-05-11 17:43   ` Kannan Varadhan
2015-05-12  2:43     ` 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=150511194356.ZM12934@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).