[R] help with oop in R - class structure and syntex

Jeffrey J. Hallman jhallman at frb.gov
Wed Feb 6 17:06:10 CET 2008


"tom soyer" <tom.soyer at gmail.com> writes:
> (1) how do I encapsulate the generics? i.e., if a class has 100 methods,
> then does it mean 100 generics would be dumped in the global environment?
> Or, is it possible to define a local environment and restrict the generics
> from one class to a particular environment? But then how do you call the
> generics from a special environment? Also, is it possible to inherit classes
> across different environment?

I think the answer is: you can't.  There is no sensible way to assign
multi-methods to a particular class.  So you have to have some sort of
database of methods and signatures that gets consulted by the dispatcher.  How 
you do a sensible IDE with this setup is beyond me.  This is my biggest
gripe with S4 methods: there doesn't seem to be any good way to browse the
environment and discover whats already in there.  S3 methods are much easier
to follow. You can do multiple dispatch with S3 methods, but hardly anyone
ever does.  My view is that multiple dispatch is not worth the complexity it
adds to a language. 

> (2) it seems that an R specific IDE would improve productivity dramatically
> (maybe even necessary?) with respect to oop. Is there such an IDE and does
> it work for oop? I recall a group (in Germany?) was working on it but I
> can't remember where I read about it.

-- 
Jeff



More information about the R-help mailing list