Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
local read-only variables (Was:[PATCH] [long] typeset doesn't report tied parameters (and related issues))
- X-seq: zsh-workers 43658
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: local read-only variables (Was:[PATCH] [long] typeset doesn't report tied parameters (and related issues))
- Date: Tue, 9 Oct 2018 11:59:47 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ei4NhnVGnx9fYdK3VfYXyz8YrR9VLHdg/soLFM6WDww=; b=bUyCGJrCwAY+SxYaoPRPtGyeN/77yh/JAu3grj7hDdNdhNjYoxz/63LGEQkoP2mLPo q5O9Vmufil74OvXX4wcopuQ4Wus5UwNeAsq/6VcfRdVdT9QPNwtep+/gEJ809B4F8/La Ac4DRBAs1QA/Ga1bgQc4qqM71JUWk73xt1/DMYqMPQozyZloxJ/x/lL+sg9Opm0pO9JO LxmKu/BqtmyL5OISn05LLT4pu31t5QTRuk8sXbyidsD0QAWLaEbMgCVazY9V0WOMcX12 Klz4zicG4UDHnNvTn1F2FBeHiE2ECJ0s3FE7esJ2IEwufvrXD+6716C5YreO1X2qOyYu Zm4g==
- In-reply-to: <20181007133545.zzkrbc3ed6shnk3e@chaz.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>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180924210550.carijwjibarjivu4@chaz.gmail.com> <20181007133545.zzkrbc3ed6shnk3e@chaz.gmail.com>
2018-10-07 14:35:46 +0100, Stephane Chazelas:
[...]
> -variable. Note that in zsh (unlike other shells) it is still possible
^^^^^^^^^^^^^^^^^^^
> -to create a local variable of the same name as this is considered a
> -different variable (though this variable, too, can be marked readonly).
> -)
> +variable.
> +
> +It is still possible to change other attributes of the variable though,
> +some of which like tt(-U) or tt(-Z) would affect the value. More generally,
> +the readonly attribute should not be relied on as a security mechanism.
> +
> +Note that in zsh (like in pdksh but unlike most other shells) it is
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> +still possible to create a local variable of the same name as this is
> +considered a different variable (though this variable, too, can be marked
> +readonly). Special variables that have been made readonly retain their value
> +and readonly attribute when made local.)
[...]
Actually also yash, we might as well remove that "(unlike other
shells)". Note that pdksh has quite a few derivatives (mksh,
posh, openbsd sh (I've not checked there)).
Those shells don't make a distinction for special variables.
Actually I'm not convinced it's useful to treat them
specially in that regard. For instance, if you do "readonly
IFS", you can no longer use library of functions that do some
"local IFS=:" If I add "readonly IFS" to .zshenv,
compaudit/compinit report errors and the shell exits with my
current ~/.zshrc.
See also related POSIX discussion at
http://austingroupbugs.net/view.php?id=767
http://austingroupbugs.net/view.php?id=767#c3735
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author