Re: [R] "privileged slots",

About this list Date view Thread view Subject view Author view Attachment view

From: Torsten Steuernagel (Torsten.Steuernagel@gmx.de)
Date: Fri 28 May 2004 - 06:55:20 EST


Message-id: <40B671D8.20218.25D99F1@localhost>

On 27 May 2004 at 19:12, Wolski wrote:

> But this document is quite intersting.

Which document are you refering to ?
 
> I have just two R questions which arised reading the document which a
> core members of the R-project cant find.

I can't find it either.

> 1. Is it intended to introduce privileged slots in the future version of
> R?

You are talking about access control like C++ (private, protected,
public) has, aren't you ? I can't answer for the R Core Team but I'm
also interested in a similar functionality. Please check the setClass()
docs for the "access" argument. I suppose this is intended to provide
such functionality in the future.
 
> 2. Is it true
> that one can gain execution speed by accessing slots using the
> function slots(object,name,check=FALSE)<-value would speed up
> execution?

Try this:

> get("@<-")
function (object, name, value)
{
    arg <- substitute(name)
    if (is.name(arg))
        name <- as.character(arg)
    "slot<-"(object, name, TRUE, value)
}

So "@<-" actually calls "slot<-". Using "slot<-" instead, you save the
additional overhead the call to "@<-" introduces. If there will be a real
performance gain in replacing "@<-" certainly depends on what you're
doing.

- Torsten

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:13 EST