On Sat, 29 Nov 2008 06:51:34 +0900, Marc Weber <[EMAIL PROTECTED]> wrote:
> I stumbled uppone one small but important issue:
> funcref('a#foo#Func') barks if the functions hasn't been loaded yet.
> Why is this bad? Because it's no longer lazy.
> Wether the function should be loaded if it doesn't exist yet should be
> done when it is called, not when the reference is created!
> ...
> I'd like to be able to use function references inconfiguration files
> without those references files beeing loaded when loading the config.
How about using a wrapper function for an autoloaded function as follows?
" in plugin/foo.vim
function WrapperFunction(...)
return call('original#function', a:000)
endfunction
" in someone's vimrc
let FuncRef = function('WrapperFunction')
If you don't have to use funcrefs, there is another way which
uses the name of a function instead of a reference for it, as follows:
let funcname = 'original#function'
call {funcname}() "==> same as :call original#function()
--
To Vim, or not to Vim.
kana <http://whileimautomaton.net/>
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---