Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Read-only variables in emulation mode
- X-seq: zsh-workers 35495
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Read-only variables in emulation mode
- Date: Tue, 16 Jun 2015 23:06:58 +0200
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=4FPv8OBJoAaUtB7x/OZj9bnechOdgT7V9szdMY8cX7o=; b=N6FrkbimklurGd+8i8hUO4lUCALqwUz6rlrE/ppvYbriyinxTWol4INMI3GZEN5oRU mWjjbKxC4UnqlYFk93/VlxinBWbqRM6lMW+PWhzm9aB7TL4uPiy6ESnWEBqllefhoIXm sJgBNcz0t02VdE0vfYa34fb49LayAO8SahW+himN3rWNY+ANrCzyokdSfi4wyQWUutxT bpYsep4c+/lF/PwyfZv1H3DYkeFLqG2GtDLpzl2XijeAMAaftIka7EEAtdBwqtSt080U 8PP8FEHBj+T1K/jw0oOhTG7D+YImzNdF5Uv3KmTMtC01jtoW7TaUi22ezaMhiodNUz5X StQA==
- In-reply-to: <150616085452.ZM26740@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAFaJEqs=P7yB-VGk=gJB2jzRf7zNiDkCuWWRADyY_xb52hGb_w@mail.gmail.com> <131216114013.ZM25877@torch.brasslantern.com> <131217223651.ZM20980@torch.brasslantern.com> <20131218192816.047ab5f5@pws-pc.ntlworld.com> <131218235723.ZM4638@torch.brasslantern.com> <CAHYJk3QtwxXabmsuYz_D-EcWSkmhLn_XWkPUnhiOU7VDdZLTPg@mail.gmail.com> <150615202431.ZM25744@torch.brasslantern.com> <CAHYJk3SyyZ8=b6p3YKaB5pwAJpVmC3_xBPM_iorbMx4pRJiriQ@mail.gmail.com> <150616085452.ZM26740@torch.brasslantern.com>
On Tue, Jun 16, 2015 at 5:54 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author