Hi Bram,

On Sun, May 29, 2016 at 9:52 AM, Bram Moolenaar <[email protected]> wrote:
>
> Yegappan Lakshmanan wrote:
>
>> To use a script local function as a job callback function, it looks like
>> you need to use function('s:<function_name>') to generate a function
>> reference. Is it possible to simply use the 's:function_name' string?
>
> That doesn't work, because the string doesn't know what script the
> function is in.  Using function() will figure that out.
>

What about expanding the function name if it starts with "s:" or "<SID>"
to <SNR><number>_<function name> in the get_callback() function?
Currently get_callback() doesn't allocate memory for the function name.
This needs to be changed to expand the function name. Maybe
arg->vval.v_string can be freed and reallocated?

>
>> Using the function name (as a string) as a callback is supported
>> for global functions.
>
> Yes, then the function will be looked up when used, no context needed.
>

This will be confusing to a user. Function name as a string can be used
for global functions but not for script local functions.

- Yegappan

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui