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

2005-06-07 Thread Duncan Murdoch

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


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

2005-06-06 Thread Peter Dalgaard
[EMAIL PROTECTED] writes:

 Is it doing an extra eval or something?  It looks like it:
 
   x - expression()
   x
 expression()
   eval(x)
 NULL
  
   x - quote(expression())
   x
 expression()
   eval(x)
 expression()
   eval(eval(x))
 NULL

You do realize that the two expression() results are not identical:

 x - quote(expression())
 class(x)
[1] call
 x - expression()
 class(x)
[1] expression

Not that I can fathom what bearing that has on the real problem...

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2005-06-06 Thread McGehee, Robert
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.

Robert

-Original Message-
From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 06, 2005 4:58 PM
To: Peter Dalgaard
Cc: r-devel@stat.math.ethz.ch
Subject: Re: [Rd] Bug in new() or validObject() in methods package
(PR#7922)


On 6/6/2005 4:55 PM, Peter Dalgaard wrote:
 [EMAIL PROTECTED] writes:
 
 Is it doing an extra eval or something?  It looks like it:
 
   x - expression()
   x
 expression()
   eval(x)
 NULL
  
   x - quote(expression())
   x
 expression()
   eval(x)
 expression()
   eval(eval(x))
 NULL
 
 You do realize that the two expression() results are not identical:
 
 x - quote(expression())
 class(x)
 [1] call
 x - expression()
 class(x)
 [1] expression
 
 Not that I can fathom what bearing that has on the real problem...

I figured they weren't identical, given that they gave different results

  when eval'd, but I didn't know what the difference was exactly.
Thanks!

Duncan

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel