zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: local unfunction
Date: Fri, 30 Mar 2018 22:23:20 -0700	[thread overview]
Message-ID: <CAH+w=7bZGJ71hfKTkLNzc9CyYgHc9i7DSVhR-9bi+-n85jGNog@mail.gmail.com> (raw)
In-Reply-To: <03b1320b-c248-adbe-55a3-49a3673453bd@eastlink.ca>

On Fri, Mar 30, 2018 at 5:30 PM, Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> playing with Mikael's use of parenthesis -- I'd swear this is the first time
> I've seen any such thing -- and it seems too good to be true, so far it just
> works.  Are there any lurking gotchas?

It's just creating a subshell, like any other time you'd put one or
more commands in parentheses.

The "lurking gotcha" is that because it is a subshell it can't affect
the parent shell in any way.  That's what Mikael means by "cancel all
other side effects" which he demonstrates with a=5.

> Disadvantages? It doesn't seem any slower.

It does fork an additional process.

> BTW, just to keep flogging a dead horse:
>
> function test1 ()
> {
> echo  "\none"
> whence -a "zsh"
> echo  "\ntwo"
> whence -ma "zsh*"
> echo  "\nthree"
> whence -m "zsh*"
> }

Try adding -w to get whence to tell you which hash table it's reading from.


  reply	other threads:[~2018-03-31  5:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-30 16:11 Ray Andrews
2018-03-30 18:47 ` Bart Schaefer
2018-03-31  0:30   ` Ray Andrews
2018-03-31  5:23     ` Bart Schaefer [this message]
2018-03-31 14:58       ` Ray Andrews
2018-03-30 20:10 ` Mikael Magnusson

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=7bZGJ71hfKTkLNzc9CyYgHc9i7DSVhR-9bi+-n85jGNog@mail.gmail.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).