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

Re: Default fpath



On Mar 15,  4:57pm, Sven Wischnowsky wrote:
} Subject: Re: Default fpath
}
} Bart Schaefer wrote:
} > Hmm, maybe autoload should have the `k' and `z' opts,
} > too, but they only work with +X (the load-it now option).  That would
} > fix something that's been bugging me for a while.
} 
} I haven't added that for autoload yet and there is another thing:
} loadautofn() should probably make use of this too, maybe execute the
} Eprog it gets from getfpfunc() when it knows that the function should
} be ksh-autoloaded (either because the dump file said so or because
} `autoload +x' said so). But then, it doesn't do that if KSHAUTOLOAD is 
} set. I guess that's some security issue?

It's not exactly a security issue; that's the "something that's been
bugging me for a while."

Autoload +X is supposed to promise that the autoloaded function is not
executed.  Unfortunately, in the kshautoload style, you have to execute
the code in order to get the function defined, which may mean executing
other code that's in the file but not inside any function body.

For at least one intended use of "autoload +X" -- finding out whether
the function is in fpath and is syntactically correct -- other code in
the file should NOT be executed; rather, you want the effect of the
`[[ -o kshautoload ]] && run-myself "$@"' trick to take effect at the
time an actual *call* to the function is made.

At the time that I added loadautofn() there wasn't any way to achieve
that result, but perhaps now with wordcode it'll be possible.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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