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

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Tue 07 Jun 2005 - 12:35:21 GMT

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



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue Jun 07 22:50:46 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:26:58 GMT