[ESS-bugs] OOps! ESS partly fails in non-English locales!
Martin Maechler
maechler at stat.math.ethz.ch
Wed Aug 3 18:18:46 CEST 2005
>>>>> "StEgl" == Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk>
>>>>> on Wed, 3 Aug 2005 16:39:09 +0100 writes:
StEgl> To follow up on parsing the output in *ESS-errors*
StEgl> I can fix the regexp for this particular error:
>>
StEgl> Error in parse(file, n = -1, NULL, "?") : syntax error on line 3
>>
StEgl> perhaps by a regexp searching for
>>
StEgl> syntax error on line [line number]
>>
StEgl> but is that likely to be good enough for catching all R errors?
>>
StEgl> Taking a look at the function ess-parse-errors, it would need not just
StEgl> the line number, but of course, the name of the file! (One hack could
StEgl> be to write the name of the source file as a comment at the top of *ESS-errors*
StEgl> within ess-load-file, e.g.
StEgl> ### Source file: foo.R
StEgl> so that could then be grabbed by ess-parse-errors.)
StEgl> However, a longer term thought might be to see if e.g R could output
StEgl> its errors in a way more typical of unix commands, e.g. grep:
StEgl> M-x grep RET defun *.el RET
StEgl> The output comes in a format that Emacs finds easy to parse:
StEgl> ess-comp.el:43:(defun ess-message (msg)
StEgl> ess-comp.el:60:;;; Components: defuns, defvars, defconsts
StEgl> ditto for outptu from gcc which can be parsed easily by Emacs.
StEgl> Is that likely to be seen favourably by R core?
I'm not sure I understand.
Do you mean R's error message should be as terse as Unix' ones?
e.g. mentioning the word 'error' at all??
R currently has basically only one of two
1) Error: ............
2) Error in foobar(.........) : ...........
where the 'foobar(.......)' can be quite quite a general
expression and doesn't need to look closely like a simple
function call.
The whole thread started because 'Error' and 'Error in' will be
translated into different locales.
I think one main difference between R and typical unix programs
is that many functions in R print information messages, text, ...
whereas in Unix successful command completion almost always
means "no output to the console at all".
In a very general, yes, I agree that R-core should think about
how error messages are to be formatted. Just because one cannot
use
r <- try(......)
if(inherits(r, "try-error"))
everywhere --- as it is usually suggested; I think we (the R
community) have recently seen examples where this lead to
wrongly running code when the "......" call also used try()
somewhere. Even more an R-core issue??
Martin
More information about the ESS-bugs
mailing list