[Rd] Bug in new() or validObject() in methods package (PR#7922)

Duncan Murdoch murdoch at stats.uwo.ca
Tue Jun 7 14:35:21 CEST 2005


McGehee, Robert wrote:
> The bug might be here:
> 
>>is.null(expression())
> 
> [1] TRUE
> 
> But
> 
>>is.null(expression(NULL))
> 
> [1] FALSE
> 
> So it might look to the methods package like you're passing in a NULL
> value for @bar. I might argue that expression() should not be NULL (and
> only NULL is NULL) as I have had similar trouble trying to extend
> language objects to S4 classes, partially because length 0 name, call
> and expression objects are either not available, or in this case,
> handled poorly.

I think you've spotted it.  The internal code for is.null checks for 
NULL or a zero length expression, not just for NULL.  Changing that so 
it only accepts NULL fixes this bug.

This code has been in place since prehistoric times, so I'm going to 
tread pretty carefully here before I commit a change.

Duncan Murdoch



More information about the R-devel mailing list