On Sunday, November 23, 2014 12:48:39 AM UTC+3, Bram Moolenaar wrote:
> ZyX wrote:
> 
> > While working on VimL parser I have seen *very* large number of these
> > cryptic error messages. I.e. consider the following line:
> > 
> >     sort no/some long regex/
> > 
> > . This will give you `E474: Invalid argument` with no further
> > explanation or an exact position where error is located. I.e. it is
> > indicating that you have a error somewhere, but where? Maybe it is an
> > error in regex (one needs to know that Vim is written in a way that
> > regexes never throw E474 to say this is false), maybe one should not
> > have omitted space or whatever. One needs to read documentation
> > thoroughly to determine what is wrong, but even this does not always
> > help: I cannot find any information about the fact that `n`, `o` and
> > `x` cannot be used together anywhere in `:sort` documentation.
> > 
> > In my parser I change all of these errors to something like “E474: Can
> > only specify one kind of numeric sort” (and always assigning a
> > position, but this part cannot be changed so easily), never using
> > “E47(4|5): Invalid argument” or “E15: Invalid expression”.
> > 
> > More or less full list of such changes to these messages (and not only
> > to messages, but this is irrelevant) is located at
> > https://gist.github.com//4af839e000e7eada347d (it is supposed to be
> > full, but I started writing it some time after I started writing the
> > parser). I am posting this message to vim-dev to hear Bram opinion
> > about this and also as a notification in case somebody will want to
> > port these changes.
> > 
> > Note: in order not to break backwards compatibility all new messages
> > look like “E474: …”, no new number is assigned. Since the following
> > message text is supposed to be localized and theoretically is a
> > subject to typo corrections it must not be relied on and changing it
> > is not going to break compatibility.
> 
> I think it helps a lot if we start using the column of the error.
> Currently only the line number is reported, which is quite often
> insufficient to located the problem.  This would be used in
> msg_source().  Probably emsg() needs to be extended to be able to pass
> the column.
> 
> Reporting a more specific error is good.  But I do think that we do need
> a separate number for every one.  Two reasons: To know what error it is
> no matter what translation has taken place, and to be able to jump to
> to a help tag.

Error message help tags only point to some commands which is pretty useless 
since line number is enough to determine command name and thus error message 
tags pointing to the same location do not add any value. And separate numbers 
are going to break scripts that match these errors. I do not see such scripts 
in my /usr/share/vim or $HOME/.vam though.

It is also strange that all three errors occur only five times in Vim own test 
suite (two (one E474, one E475 and zero E15) if you squash related 
occurrences): this means that error conditions are almost never tested given 
how widespread these errors are.

> 
> You could make patches for the Vim source code, and make the same
> message change to your parser, to keep them in sync.

I actually was not going to create such patches now because this is too much 
work. Definitely not until I finish the parser.

> 
> -- 
> A special cleaning ordinance bans housewives from hiding dirt and dust under a
> rug in a dwelling.
>               [real standing law in Pennsylvania, United States of America]
> 
>  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org        ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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/d/optout.

Raspunde prin e-mail lui