On 4 April 2016, Bram Moolenaar <b...@moolenaar.net> wrote: > tldr: Proposal: Change loading packages from pack/start (and > :packloadall) to first add all directories to 'runtimepath' before > sourcing the plugins.
After pondering about it for a while, I'm pretty sure this is the right thing to do. It closes all sorts of race conditions, including the problem of mutually recursive autoloads. > Lcd wrote: [...] > > There is still the issue of finding scripts depth-first. This is > > fine for glob(), and possibly also for runtimepath, but it doesn't make > > sense for loading. Presumably the main script always has to be loaded > > first. > > I haven't seen an example of this, and as mentioned, it already is the > current behavior. Syntastic is an example I'm familiar with: https://github.com/scrooloose/syntastic It has this structure: syntastic |-- CONTRIBUTING.md |-- LICENCE |-- README.markdown |-- _assets | `-- screenshot_1.png |-- autoload | `-- syntastic | |-- c.vim | |-- log.vim | |-- postprocess.vim | |-- preprocess.vim | `-- util.vim |-- doc | `-- syntastic.txt |-- plugin | |-- syntastic | | |-- autoloclist.vim | | |-- balloons.vim | | |-- checker.vim | | |-- cursor.vim | | |-- highlighting.vim | | |-- loclist.vim | | |-- modemap.vim | | |-- notifiers.vim | | |-- registry.vim | | `-- signs.vim | `-- syntastic.vim `-- syntax_checkers |-- actionscript ... The main script is "plugin/syntastic.vim". This script loads everything in "plugin/syntastic": runtime! plugin/syntastic/*.vim The scripts in "plugin/syntastic" make no sense on their own, and they can't be run before "plugin/syntastic.vim" because they call functions from the main script. For this reason, they have to make sure overly eager package managers (and now Vim itself) don't try to load them out of turn: if exists('g:loaded_syntastic_notifier_cursor') || !exists('g:loaded_syntastic_plugin') finish endif let g:loaded_syntastic_notifier_cursor = 1 Going through "plugin/**/*.vim" depth-first is harmless because these scripts are prepared for it. But doing that is wasteful, and having to be prepared for that is an unnecessary trap for script writers. I can't imagine any situation when it would be _useful_ to load scripts in (some other package's equivalent of) "plugin/syntastic" before the main scripts, and I can easily imagine plenty of scenarios when it's harmful. Why would anybody _expect_ such a thing, to begin with? /lcd -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.