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

PATCH: Re: Default fpath



Bart Schaefer wrote:

> ...
>
> 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.

Ah. Hm. I thought of `autoload +X' only as some kind of forced-loading 
and in that case we would have to execute ksh-autoloaded functions
once.

Syntax checking is possible with zcompile, btw:

  zcompile /dev/null <path-to-func> ...

or

  zcompile -c /dev/null <func> ...

Hm, no patch for the autoload thing yet, until someone else makes a
decision here.


The patch fixes a bug where loadautofn(), when called from
eval_autoload() could leave an invalid funcdef field in a shfunc
struct.


Bye
 Sven

diff -ru ../z.old/Src/exec.c Src/exec.c
--- ../z.old/Src/exec.c	Thu Mar 16 09:45:39 2000
+++ Src/exec.c	Thu Mar 16 09:55:58 2000
@@ -3211,6 +3211,7 @@
 
     if (prog == &dummy_eprog) {
 	zerr("%s: function definition file not found", shf->nam, 0);
+	shf->funcdef = prog;
 	return 1;
     }
     if (!prog)

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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