original (update follows)
I work with many anonymous functions, i.e. functions declared as part of a dictionary, otherwise called "methods". This becomes quite painful for debugging, because I canβt say in which function the errors occur.
Vim outputs are as follows:
Error detected while processing function NamedFunction..2111..2105: line 1: E730: using List as a String
This trace shows that an error occurred at the third level down the stack, in the first line of anonymous function # 2105. IE NamedFunction is called anonymous function # 2111, which is called anonymous function # 2105. NamedFunction is declared through the usual syntax function NamedFunction() ... endfunction ; others were declared using code like function dict.func() ... endfunction .
Therefore, obviously, I would like to know which function has the number 2105.
Assuming that it is still in scope, you can find out what the dictionary entry refers to by resetting all dictionary variables that may contain this link. This is awkward and difficult to be systematic, although I think I could fine-tune the search function of all the loaded dictionaries to link to this function by observing circular links. Although in order to be really thorough, he would have to look not only for script-local and global dictionaries, but also for buffered local dictionaries; is there any way to access other local buffer variables?
In any case, I wonder if it is possible to download the source code for an anonymous function instead. That would be much simpler and probably more reliable.
Update
I ended up about this a while ago on the vim_use mailing list. Bram Moolenar, aka vim BDFL , responded by saying that "you should not use the function number." However, a suitable alternative for this functionality has not been proposed as of early September 2010. It was also not clearly stated whether this functionality will continue to work in future versions of vim. I did not try to do this (or anything else, for that matter) in the recently released vim 7.3.
source share