From ripley at stats.ox.ac.uk  Mon Jan 24 13:21:46 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon Jan 24 13:21:53 2005
Subject: [Rd] Very Long Expressions
In-Reply-To: <41F4D465.6030501@lancaster.ac.uk>
References: <67DCA285A2D7754280D3B8E88EB5480206741E2E@MSGBOSCLB2WIN.DMN1.FMR.COM>
	<41F4D465.6030501@lancaster.ac.uk>
Message-ID: <Pine.LNX.4.61.0501241210330.17805@gannet.stats>

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


[Rd] Very Long Expressions
Prof Brian Ripley