
On Sun, Apr 17, 2011 at 6:31 AM, Peter Dimov <pdimov@pdimov.com> wrote:
Jeff wrote:
Okay, I can buy that in some circumstances, you want syntax errors to be
silently ignored.
No. You are looking at the problem from a programmer perspective,
Only natural, right? ;)
but when these errors are introduced, there is no programmer present. As a matter of fact, the programmers may already have been fired. The person who is translating the text is introducing the errors, and he is the one who needs to be able to see them and fix them. The best way to do that is for the translate/format functions to return a string from which one can deduce that a syntax error has occurred, so that the translator (or the user) can see the error appearing instead of the properly translated text - without this interfering with the user's ability to continue using the software as would happen if an exception aborted the entire, potentially time consuming, operation. This does not "silently ignore" the errors, it reports them in an appropriate way, to the appropriate person.
Artyom seemed to imply that the result string would give little or no indication of an error, although it was never really specified what "silently ignore" meant beyond not throwing. It would certainly make the translator's job easier if they had some obvious indication there was a translation error. Now, you could make the case that you, as a programmer, should still have
the error reported to you by the library so that you can log it (if the library doesn't have built-in logging support), which of course would also allow you to promptly proceed to ignore everything that's been said and make the error handlers throw exceptions. :-)
I'm having trouble parsing this (which error handlers? those in boost::locale::format?), but it sounds like you accept that there may be scenarios under which a syntax error should throw an exception or perform some other task, e.g., log the error. - Jeff