>> 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. -- -- 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 --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/s922g7%2414o9%241%40ciao.gmane.io.