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

From: Henrik Bengtsson <hb_at_stat.berkeley.edu>
Date: Tue, 5 Feb 2008 08:03:48 -0800

On Feb 5, 2008 6:06 AM, Barry Rowlingson <b.rowlingson_at_lancaster.ac.uk> wrote:
> Duncan Murdoch wrote:
>
> > Another problem is that there are two different class systems in R:
> > sometimes calls S3 and S4 (because of the versions of S where they were
> > introduced). You were reading about S3.
>
> There's three different class systems if you also include the R.oo
> add-on package[1]. Even perl, the language seemingly founded on the
> concept of TMTOWTDI[2], only has the one OOP system.

Not really, the R.oo package is using/promoting vanilla S3. On top of that, there is a root class Object that "inherits" the 'environment' class (I use quotation marks, because you cannot/should not inherit directly from the 'environment' class but wrap it up in a list structure or similar; see R-devel threads on this). Since the Object class extend 'environment', instances of class Object can be passes by reference, just like 'environment' objects. It is that option of passing objects by references that differ from common practices in R, but I would say that is orthogonal to S3/S4 class system. But yes, this setup allows you to do OOP in a more Java/C++/... style.

Best,

Henrik

>
> Barry
>
> [1] http://www1.maths.lth.se/help/R/R.oo/
> [2] There's More Than One Way To Do It
>
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 05 Feb 2008 - 16:08:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Feb 2008 - 16:30:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive