Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Read-only variables in emulation mode



On Tue, Jun 16, 2015 at 5:24 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> 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
> }
> } I'm not sure if this is better than printing a warning that $_ is
> } readonly. :)
>
> 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.
>
> Admittedly that's a pretty constrained use case.

It's currently hooked up to nullstrsetfn, and was when it was readonly
too, so I guess this never worked as intended.

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author