zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: Read-only variables in emulation mode
Date: Tue, 16 Jun 2015 23:06:58 +0200	[thread overview]
Message-ID: <CAHYJk3TVA5hbKuwUJk34_1VOvn0Ukm-6-6Yf263HM12qKmhd7w@mail.gmail.com> (raw)
In-Reply-To: <150616085452.ZM26740@torch.brasslantern.com>

On Tue, Jun 16, 2015 at 5:54 PM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> On Jun 16,  8:24am, Mikael Magnusson wrote:
> }
> } > On Jun 16,  2:10am, Mikael Magnusson wrote:
> } > }
> } > } % echo hi; _=foo; echo $_
> } > } hi
> } > } hi
> } >
> } > That's actually a bug -- the assignment _=foo should erase $_ , I think.
> } >
> } > } % for _ in a b c; do echo $_ hi; done
> } > } hi
> } > } hi hi
> } > } hi hi
> } >
> } > If you go back to the original message in the thread, the whole point
> } > was to use $_ as a dummy variable that didn't need to be declared and
> } > whose value was instantly discarded.  For that purpose, the warning is
> } > extraneous.
> }
> } It's currently hooked up to nullstrsetfn, and was when it was readonly
> } too, so I guess this never worked as intended.
>
> I'm not sure what "never worked as intended" is aimed at.
>
> "That's actually a bug" -- $_ should be erased because there is no command
> for a last argument to be taken from, not because it's been assigned foo.
>
> "use $_ as a dummy variable" -- that didn't work as intended before, but
> it does now.
>
> So what never worked and what was intended?
>
> As with $0 in the other thread, "local -h _" works.

Oh, the intention was never to actually use the assigned value of $_?
In that case I completely misunderstood things... Oops, I just went
back to the original message and noticed "throwaway" now. I came here
from IRC where we were talking about using variables without having to
declare them local, so my context was a bit wrong.

-- 
Mikael Magnusson


  reply	other threads:[~2015-06-16 21:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 19:10 Øystein Walle
2013-12-16 19:40 ` Bart Schaefer
2013-12-18  6:36   ` Bart Schaefer
2013-12-18 19:28     ` Peter Stephenson
2013-12-19  7:57       ` Bart Schaefer
2015-06-16  0:10         ` Mikael Magnusson
2015-06-16  3:24           ` Bart Schaefer
2015-06-16  6:24             ` Mikael Magnusson
2015-06-16 15:54               ` Bart Schaefer
2015-06-16 21:06                 ` Mikael Magnusson [this message]
2015-06-16 19:05             ` Bart Schaefer

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=CAHYJk3TVA5hbKuwUJk34_1VOvn0Ukm-6-6Yf263HM12qKmhd7w@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=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).