Hi Nikolay! On Sa, 09 Jul 2016, Nikolay Aleksandrovich Pavlov wrote:
> 2016-07-08 13:36 GMT+03:00 Bram Moolenaar <b...@moolenaar.net>: > > > > Nikolay Pavlov wrote: > > > >> I am also wondering why evalcmd()? When discussing the name in Neovim > >> bug tracker I was against `evalcmd()` because for `eval('expr')` > >> expression result is expected to be the only effect (though it is not > >> necessary, most expressions used with `eval()` do not have > >> side-effects). Commands on the other side do not have any results of > >> evaluation at all, they are run for their side-effects and `capture()` > >> just records one of their side-effects, so `eval…` is not a good name. > >> Note that this function is not going to be used only for capturing > >> output, in some cases it will be just a replacement for `:execute` > >> which works in expression context. > > > > Yeah, I'm also not happy with evalcmd(). It seemed right at first, but > > comparing to eval() it's quite different. > > > > I also don't like capture(), since it's actually executing the commands. > > > > It's actually more like system(), which already was a weird name from > > old days. > > > > Perhaps we should call it execute() ? > > It's executing commands and returning the output seems like an obvious > > thing for such a function to return. > > Main argument against `execute()` was that “executing commands” is > obvious and common, but “returning the output” is not. `exec` from > Python or Vim do not do this: in Python it returns None (unless it is > Python 2 where it is a keyword with special syntax and not a function, > so one cannot say it returns anything at all), in Vim it is a command > itself, `exec` in C/shell is entirely different, but again not > returning an output: here it either returns an error or replaces the > current process. > > I would really suggest to read the [issue][1] in Neovim bug tracker, > there were many suggestions. And now, besides arguments that can be > found there, there is additionally “Neovim already has such function > and it is named `capture()`”. As for the bikeshedding: Its returning the output of a command, so why not call it output({cmd}) or even message({cmd}) BTW: there does not seem to be a tag for {cmd} On the other hand, I don't really mind the current name. Best, Christian -- Ein jeder Mensch hat rechtmäßigen Anspruch auf Achtung von seinen Nebenmenschen, und wechselseitig ist er dazu auch gegen jeden anderen verbunden. -- Immanuel Kant (Die Metaphysik der Sitten) -- -- 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.