Hi Troy --
Troy Robertson wrote:> I am new to R programming but have dived into a medium sized modelling
software development project.
>
> Having come from a Java OO background I have a couple of questions about S4
objects.
>
>
>
> Is there a way to make S4 slots (and methods) private and hence force the
use of accessor methods?
No, except by convention (e.g., 'don't directly access slots
name-mangled in this way'; non-package code must never directly access
slots')
>
>
>
> Is there a straight-forward way to implement pass-by-reference for method
parameters?
>
> I am currently returning and overwritting updated objects which is clunky
and costly and would like a more efficient way of doing this.
no, copy-on-change is the most common semantic in R; using an
'environment' provides some flexibility, but use with S4 introduces
twists. See this concurrent thread
https://stat.ethz.ch/pipermail/r-help/2009-June/200038.html
(my 2 cents:) embracing rather than avoiding the paradigm might lead to
different designs, e.g., 'column-oriented' (an S4 instance representing
an entire table) rather than row-oriented (an S4 instance for each row)
data structures.
>
>
> Can anyone point me to some useful texts on S4 programming apart from the
following:
>
> Chambers - Software for Data Analysis: Programming with R
>
> Venables - S Programming
>
Gentleman, R Programming for Bioinformatics.
Hope that helps.
Martin>
>
> Thanks heaps
>
>
>
> Troy
>
>
>
>
>
>
> ___________________________________________________________________________
>
> Australian Antarctic Division - Commonwealth of Australia
> IMPORTANT: This transmission is intended for the addressee only. If you are
not the
> intended recipient, you are notified that use or dissemination of this
communication is
> strictly prohibited by Commonwealth law. If you have received this
transmission in error,
> please notify the sender immediately by e-mail or by telephoning +61 3 6232
3209 and
> DELETE the message.
> Visit our web site at http://www.antarctica.gov.au/
> ___________________________________________________________________________
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel