RE: [Rd] new("call") problem (PR#7490)

From: <Robert.McGehee_at_geodecapital.com>
Date: Tue 11 Jan 2005 - 02:47:08 EST


I have found a solution to the new("call") problem that I believe produces the correct behavior for the default call object, and am also reclassifying this as a bug, as I believe the current behavior to be incorrect.

Recap, the following error occurs:
> new("call")

Error in print("<undef>"()) : couldn't find function "<undef>"

It looks like the problem is that the default object for new("call") is the function "<undef>"(), which does not exist. So, the show() and print() methods correspondingly fail.

If I initialize the "<undef>"() function at the beginning of my code to an empty function:

> "<undef>" <- new("function")

then new("call") will then reference an existing (yet empty) object that is coerced into a call, and the show and print methods correctly display this object as NULL. Furthermore, I am able to extend this empty call object to other S4 objects without trouble.

Now:
> "<undef>" <- new("function")
> new("call")

NULL
> str(new("call"))

Formal class 'call' [package "methods"] with 0 slots  list()

This, I believe is the preferred behavior of new("call"), and I would contend this fix should be included in the R source.

Best,
Robert

-----Original Message-----
From: McGehee, Robert [mailto:Robert.McGehee@geodecapital.com] Sent: Saturday, January 08, 2005 6:06 PM To: r-devel@stat.math.ethz.ch
Subject: [Rd] new("call") problem

The below looks like the show method has trouble with the default call object (or that there is no default call object). Not sure if this is a bug, design problem, or a difficulty on my part using and extending the call class, but it has caused difficulty for when I want to extend the call class into other S4 classes.

> new("call")

Error in print("<undef>"()) : couldn't find function "<undef>"

This error pops up when I show an object with an empty call slot. Error in show("<undef>"()) : Unable to find the argument "object" in selecting a method for function "show"

I'll leave it up to the developers to designate this as a bug or not, but I would certainly prefer that new() and show() never reports errors when an empty object is passed as an argument (of any class).

Best,
Robert

Robert McGehee
Geode Capital Management, LLC
53 State Street, 5th Floor | Boston, MA | 02109 Tel: 617/392-8396 Fax:617/476-6389
mailto:robert.mcgehee@geodecapital.com

This e-mail, and any attachments hereto, are intended for use by the addressee(s) only and may contain information that is (i) confidential information of Geode Capital Management, LLC and/or its affiliates, and/or (ii) proprietary information of Geode Capital Management, LLC and/or its affiliates. If you are not the intended recipient of this e-mail, or if you have otherwise received this e-mail in error, please immediately notify me by telephone (you may call collect), or by e-mail, and please permanently delete the original, any print outs and any copies of the foregoing. Any dissemination, distribution or copying of this e-mail is strictly prohibited.



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 Received on Tue Jan 11 01:56:21 2005

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:02:33 EST