>> What is Vim9's equivalent of the following?
>>
>> fun Callback(value, _j, _e)
>> echom 'callback with value: ' .. a:value
>> endf
>>
>> fun Func()
>> call job_start(['/bin/bash', '-c', ':'],
>> \ {'exit_cb': function('Callback', [42])})
>> endf
>>
>> call Func()
>
> I don't think there is a difference, you can still use function() to
> create a partial.
A definition such as this:
def Func()
job_start(['/bin/bash', '-c', ':'],
\ {'exit_cb': function('Callback', [42])})
enddef
results in `E117: Unknown function: Callback` (in Vim 8.2.2900).
> Is there a "Vim9 way" that would be better? You could use a lambda:
>
> call job_start(['/bin/bash', '-c', ':'],
> \ {'exit_cb': (j, e) => Callback(42, j, e)})
>
> It looks a bit nicer.
I like that. It is explicit about the arguments and it allows me to
reorder the callback's parameters as I see fit. And yes, it works.
Thanks,
Life.