Friday, April 1, 2011

Re: What is supposed to happen if there is an error in a vim script?

> However none of you answered,
> >> Are these kinds of exception rules spelled out explicitly
> >> anywhere in the available documentation?
> >> Not just mentioned in passing by an example!
>
> >> Where are the rules for this detailed?
>
> Or is this an impossible task, since the rules of vim
> are not regular, but an ad hoc collection?
> (like French grammar. :-) )

French grammar is pretty regular compared to some languages! ;-)

I think the answer is that because error checking depends on the
context, it is documented at commands which change the error handling,
not as a set of overarching rules. So you will find details about error
handling while mappings are running somewhere near the :map command, and
how it works within :try blocks at the :try command, and how it works
while executing :global at that command, somewhere near :function the
abort modifier is explained, etc..

I guess the overarching rule, which I don't know if it's documented
anywhere, is that the way errors are handled depends on the 'enclosing
context' or something like that.

And Vim scripts, if just sourced, work just like running the commands
one after the other at the commandline, i.e. the next command is simply
typed in and executed regardless of the errors of the previous one. I
think that is in the docs somewhere, but no idea where....

So, yes, I guess in a sense that's a "the rules are not regular, but
they ARE documented (all over the place)."

Does that come close to answering your question?

Ben.

--
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

No comments:

Post a Comment