From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14411 invoked from network); 16 Mar 2000 09:04:24 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 Mar 2000 09:04:24 -0000 Received: (qmail 27385 invoked by alias); 16 Mar 2000 09:04:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10156 Received: (qmail 27373 invoked from network); 16 Mar 2000 09:04:12 -0000 Date: Thu, 16 Mar 2000 10:04:10 +0100 (MET) Message-Id: <200003160904.KAA28186@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Wed, 15 Mar 2000 18:15:05 +0000 Subject: 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 ... or zcompile -c /dev/null ... 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@informatik.hu-berlin.de