Re: [Rd] Very Long Expressions

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon 24 Jan 2005 - 23:21:46 EST

On Mon, 24 Jan 2005, Barry Rowlingson wrote:

> McGehee, Robert wrote:
>
>>> a <- eval(parse(text = paste(rep(1, 499), collapse = "+")))
>
> Another little investigation shows that if you type:
>
> 1+1+......+1
>
> at the > prompt (with over 498 '+1's) both R1.8.1 and R2.0.0 produce an error
> message, so it would appear to be something specific to the eval() function
> in R 2.0.x suppressing the error message.

It's not. An error is being thrown whilst trying to print the message, as that is doing an evaluation, and recursive errors bail out without printing. I suspect this is due to the deparsing changes in 2.0.0, but a simple fix is to make sure the call is not printed, as in

         errorcall(R_NilValue, "evaluation nested too deeply: infinite recursion / options(expression=)?");

in eval.c:288 (You don't actually need to know as the problem is caused at the top-level expression immediately preceeding the error.)

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon Jan 24 23:39:51 2005

This archive was generated by hypermail 2.1.8 : Tue 25 Jan 2005 - 01:23:31 EST