[ESS] ess-developer and S3 methods

Vitalie Spinu spinuvit at gmail.com
Mon Nov 4 22:51:15 CET 2013


This is sort of a "feature" forcing people to use S4 :P. I have the
following comment in ESSR/developer.R:

   ## COMMENT ON S3 METHODS: It is not feasible and, quite frankly, a bad practice
   ## to check all the assigned function names for "." separator. Thus, S3 methods
   ## are not automatically registered. You can register them manually after you
   ## have inserted method_name.my_class into your package environment using
   ## ess-developer, like follows:
   ##
   ##    registerS3method("method_name", "my_class", my_package:::method_name.my_class)
   ##
   ## Otherwise R will call the registered (i.e. cached) S3 method instead of the
   ## new method that ess-developer inserted in the package environment.

If I remember correctly, R doesn't provide a way to check whether a
function is a registered S3 method and I would have to check every
attached namespace for S3 tables.  Now I forgot the details but I see
the handling of local S3 tables in developer.R. So if you evaluate an S3
meethods for a generic which is defined in the same package, everything
should be fine. For generics defined in other packages, you are out of
luck.

Anyways, patches are welcome. If you have an idea of how to check for S3
methods, let me know.

  Vitalie

 >>> Andreas Leha on Mon, 4 Nov 2013 21:21:19 +0100 wrote:

 > Hi all,
 > I am developing a package that contains an S3 method for the predict
 > function.

 > ess-eval-function only seems to behave as expected.  It even produces
 > the messages

 > ,----
 > | Eval function predict.foo
 > | NS: FUN[predict.foo]  
 > `----

 > But apparently it does not register the new S3 method?  Calling it (and
 > running getS3method("predict", "foo")) still shows the old code.

 > Do I miss something here?

 > Regards,
 > Andreas

 > ______________________________________________
 > ESS-help at r-project.org mailing list
 > https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list