From jmc at r-project.org  Wed Apr  6 18:50:39 2011
From: jmc at r-project.org (John Chambers)
Date: Wed, 06 Apr 2011 09:50:39 -0700
Subject: [Rd] S4 generic functions/methods vs enclosures
In-Reply-To: <1302101685181-3430950.post@n4.nabble.com>
References: <1302101685181-3430950.post@n4.nabble.com>
Message-ID: <4D9C99DF.3060506@r-project.org>

Look at ?ReferenceClasses for this OOP paradigm in R, which is quite 
different from the functional paradigm of S4 methods.

On 4/6/11 7:54 AM, A Zege wrote:
> Apologies for asking something that is probably very obvious, i just started
> with S4 classes and i guess i am not finding documentation that lays out the
> grammar rules and gives enough examples.
>
> I understand that main method of writing a member function is to write a
> generic function and setMethod for this particular class. This, however,
> presumes that there is "virtuality" for this function, i.e. it could be used
> with other inherited classes . Truth is, many, if not most of my functions
> don't have virtuality in mind. I want to write them inside classes to
> achieve incapsulaton only -- use class member data without passing it as
> parameters or making global to a bunch of functions and have some specific
> class member functions that don't pollute a global namespace and can be
> called only for a particular class. This is what enclosured do in R. Is
> there some obvious way of setting this environment local to a class and
> without writing generic functions that i am missing?
>
>
> Would appreciate any pointers
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/S4-generic-functions-methods-vs-enclosures-tp3430950p3430950.html
> Sent from the R devel mailing list archive at Nabble.com.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] S4 generic functions/methods vs enclosures
John Chambers