From murdoch at stats.uwo.ca  Tue Jun  7 14:35:21 2005
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Tue Jun  7 14:35:47 2005
Subject: [Rd] Bug in new() or validObject() in methods package (PR#7922)
In-Reply-To: <67DCA285A2D7754280D3B8E88EB548020C9465EB@MSGBOSCLB2WIN.DMN1.FMR.COM>
References: <67DCA285A2D7754280D3B8E88EB548020C9465EB@MSGBOSCLB2WIN.DMN1.FMR.COM>
Message-ID: <42A59489.3010905@stats.uwo.ca>

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


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