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

Re: Surprising effect of fun() { local FPATH=...; autoload -X }, and a bug



On Sep 30,  8:03am, Sebastian Gniazdowski wrote:
} Subject: Re: Surprising effect of fun() { local FPATH=...; autoload -X }, 
}
} > Your autoload wrapper that sets up the "local FPATH" needs to store
} > the FPATH value for each module somewhere
} 
} This would lead to aliases? The autoloaded function would have to have
} "autoload" calls translated into "zplg_autoload" calls.
[...]
} I could also make autoload wrapper continuously active in Zsh session
} but that doesn't look nice to me.

The wrapper would have to change so that it does the full monty only
when called in a known module context.  (Which returns to the question
of whether that can be discovered at the right time.)

} Having fpath-extending loading support in place doesn't mean that
} clean-FPATH goal will not be reached.

It's your software, make the design decision that you think best!

} Btw. I've stumbled upon following code in execcmd / exec.c:3054:
} 
}     } else if (is_shfunc || type == WC_AUTOFN) {
}         Shfunc shf;
}         if (is_shfunc)
}             shf = (Shfunc)hn;
}         else {
}             shf = loadautofn(state->prog->shf, 1, 0);
} 
} Is this the place where autoload-marked functions are differentiated
} from manual-autoload-stub functions?

It's the place where already-defined functions (stub or otherwise) are
differentiated from autoloads that still need to be pulled in.



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