Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Read-only variables in emulation mode
- X-seq: zsh-workers 35488
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: Read-only variables in emulation mode
- Date: Tue, 16 Jun 2015 08:54:52 -0700
- In-reply-to: <CAHYJk3SyyZ8=b6p3YKaB5pwAJpVmC3_xBPM_iorbMx4pRJiriQ@mail.gmail.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>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author