Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Re: Compsys and KSH_AUTOLOAD
- X-seq: zsh-workers 19791
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: PATCH: Re: Compsys and KSH_AUTOLOAD
- Date: Sun, 18 Apr 2004 15:46:18 +0200
- In-reply-to: <1040416172538.ZM30371@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <1040410174430.ZM10891@xxxxxxxxxxxxxxxxxxxxxxx> <1170.1081778412@athlon> <040412085942.ZM19035@xxxxxxxxxxxxxxxxxxxxxxx> <3571.1081806187@athlon> <1040413053826.ZM20012@xxxxxxxxxxxxxxxxxxxxxxx> <18035.1081870188@xxxxxxxxxxxxxxxxxxxxx> <1040413175111.ZM21011@xxxxxxxxxxxxxxxxxxxxxxx> <13987.1082134179@xxxxxxxxxxxxxxxxxxxxx> <1040416172538.ZM30371@xxxxxxxxxxxxxxxxxxxxxxx>
Bart wrote:
> On Apr 16, 6:49pm, Oliver Kiddle wrote:
> }
> } Why do export and readonly accept -f arguments? Is that just to avoid
> } errors on bash scripts? Any reason why we shouldn't implement readonly
> } functions.
>
> It could get pretty tricky to have a readonly autoloaded function. Does
> the function become readonly only after the autoload occurs? What *can*
> one change about a readonly function -- can one `typeset -t' it? If it
> hasn't been loaded yet, can the new ksh/zsh autoload flags be changed?
We seem to be generous in allowing various typeset flags to be changed
for readonly variables so I see little reason to prevent typeset -t.
Bash doesn't have autoloadable functions so we can't just look at how
it works. We could prevent changing the definition of the function but
allow it to be autoloaded if it was already declared autoloadable. And
you can't make an existing function autoloadable without first using
unfunction anyway.
By the way, in a restricted shell, ksh restricts FPATH (zsh doesn't).
> BTW, independent of readonly, what do +z and +k mean? Revert the
> function to using the current global ksh_autoload setting? What happens
> if you use +k on a function that has -z ?
They remove the PM_ZSHSTORED or PM_KSHSTORED flag respectively. So if
PM_ZSHSTORED is set, +k will do nothing. You need `+k +z' to be sure of
returning it to the global ksh_autoload setting. In contrast -z or -k
alone will remove a contradictory flag. This is consistent with how the
-E and -F flags work: you need `+E +F' to convert a float to scalar.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author