You are not supposed to use the function number. Use the name under
which it is stored. E.g. for the example:
:let mydict = {'data': [0, 1, 2, 3]}
:function mydict.len() dict
: return len(self.data)
:endfunction
:echo mydict.len()
You can use
:function mydict.len
--
A consultant is a person who takes your money and annoys your employees while
tirelessly searching for the best way to extend the consulting contract.
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
I'd like to say it's a cool workaround, thanks for sharing!
> You are not supposed to use the function number. Use the name under
> which it is stored. E.g. for the example:
>
> :let mydict = {'data': [0, 1, 2, 3]}
> :function mydict.len() dict
> : return len(self.data)
> :endfunction
> :echo mydict.len()
>
> You can use
> :function mydict.len
The obvious question is: If all you get from the error message is a
number, how do you know this number represents mydict.len()?
The topic has come up before:
getting more information about numbered functions in traces?
http://groups.google.com/group/vim_use/browse_thread/thread/63f4de4d7afd900/b8357da9088ad333
And there is an item in the todo list (:h todo):
It's difficult to debug numbered functions (function in a Dictionary). Print
the function name before resolving it to a number?
let d = {}
fun! d.foo()
echo "here"
endfun
call d.foo(9)
--
Andy
--
You received this message from the "vim_use" 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