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

Re: zsh-workers 43616, typeset doesn't report tied parameters



Stephane Chazelas schrieb/wrote:
> 2018-10-09 00:54:16 +0200, TS:
> [...]
>> IMHO when a readonly is tied, the newly tied var (either scalar or array what
>> ever comes last) should take over the content AND the readonly flag in one go.
>> OR a readonly should not be tieable at all.
> [...]


> readonly is kind of a programming aid (reminder that the
> parameter  should be constant). Tied parameters are really
> designed for the LD_LIBRARY_PATH, INFOPATH... They are
> different concepts that would generally not be used together I
> would say.

apart from malicious code writers.

e.g.:
% prv() { print -l "${(t)${(P)1}} ${1}=${(P)1}" ; }
% IMPORTANTVAR=foo
% prv IMPORTANTVAR
scalar IMPORTANTVAR=foo
% readonly IMPORTANTVAR
% prv IMPORTANTVAR
scalar-readonly IMPORTANTVAR=foo
% IMPORTANTVAR=buuz
zsh: read-only variable: IMPORTANTVAR
% prv IMPORTANTVAR
scalar-readonly IMPORTANTVAR=foo
% typeset -T IMPORTANTVAR importantvar
zsh: read-only variable: IMPORTANTVAR
% prv IMPORTANTVAR
scalar-readonly-tag_local IMPORTANTVAR=foo
% prv importantvar
array-tag_local importantvar=foo
% importantvar=(buuz)
% prv IMPORTANTVAR
scalar-readonly-tag_local IMPORTANTVAR=buuz

basically currently the readonly flag is bypasable this way for every var
and therefore mood. Somehow i can't believe this is by design, instead of an
overlook.



Mit freundlichen Grüßen

    Thilo Six



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