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

Re: PATCH: Re: Compsys and KSH_AUTOLOAD



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