On 09:10 Mon 11 Nov     , Vlad Irnov wrote:
> On 11/4/13, ZyX <[email protected]> wrote:
> >> This means in Vim 7.4 Vim script stops after a Vim error occurs in
> >> Python code. This seems very wrong to me. Vim script writers are used
> >> to the fact that VimL code execution does not stop after an error
> >> unless there is a try/catch or when function has "abort" argument.
> >
> > Code that relies on this is broken. No matter how is some functionality used
> > it *can* be put inside try/catch by the user*. I already got a few “nice” to
> > debug bugs when was assuming `echoerr` is not breaking execution flaw (note:
> > without any traces of python). Now they will be easier to fix: now when I
> > see `echoerr` I say I must remove it.
> >
> > For echoing errors from python there is `sys.stderr`.
> >
> > Besides, any error shown to user indicates a bug.
> >
> > *:
> >
> > - Any command and function can be naturally put inside :try/catch in a
> > script.
> > - Any mapping can be called with :normal that can be put inside :try/catch.
> > - Any autocommand can be called either directly with :doau inside :try/catch
> > or by putting commands that invoke autocommand inside :try/catch (i.e. :e
> > for BufRead*).
> >
> > There is no way write code that will never stop execution on error without
> > using :silent! or :try/catch catching the error on your own. Hence any error
> > must be considered to break execution. Any code that considers error not
> > breaking execution is broken.
> 
> All this is true in theory. In practice, nobody ever puts the entire
> Vim script plugin inside try/finally/endtry. The simplest case:
> 
> let s:keepcpo= &cpo
> set cpo&vim
> echo 1
> let a = bogus
> echo 2
> python a = bogus
> echo 3
> python vim.command("let a=bogus")
> " execution stops here
> echo 4
> let &cpo= s:keepcpo
> unlet s:keepcpo
> 
> When such script is sourced, execution does not stop after a Vim
> script error or a regular Python error. Why should it stop after a
> Python vim.error error? This is an inconsistent behavior of Vim error
> handling that is bound to cause confusion.
> 
> Regards,
> Vlad

Just throwing an idea.  Maybe:
    vim.command("echoerr 'py-vim-Error'")
should raise a Python exception?

Best regards,
Marcin

-- 
-- 
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/groups/opt_out.

Raspunde prin e-mail lui