Hi!

The simplest way to find the document is
?checkSlotAssignmen
A function which is described there and which Matthias Kohl mentioned in his e-mail
You will find it also using the html search form of the html documentation searching for RClassUtils.

Its true that the document is a little hidden what I havent noticed (Sorry Martin). The functions described in it are not listed in the 00index.html file of the methods package. (Why!?)  I found the document by the first trial by typing ?checkSlotAssignment.

There was a lot of discussion going on at about S4 at the useR confernce. Much more than at this list. Maybee because the only understandable text about S4 about wich i knew is "Programming with Data" J. Chambers. (The descriptions to the method package is for me quite hard to read.)
Maybee also because no one knews how big exactly is the performance sacrifice caused by the additional features. Therefore, this "less" official document is of some value because it allows to make some benchmarks.

I was running some test cases to figure out how many(much?) time one can gain by setting check=FALSE check=TRUE. And how using slot instead of @ infuences the execution speed.

I run a for loop with x in 1:10000 with the following assignments in the loop:
                                                                                                    [s]
tmp@info <- paste("test",x,sep="")                              2.55    0 2.71   NA   NA
slot(tmp,"info",check=T) <- paste("test",x,sep="")      2.36    0 2.50   NA   NA
slot(tmp,"info",check=F) <- paste("test",x,sep="")      0.67    0 0.80   NA   NA
paste("test",x,sep="")                                                   0.50    0 0.63   NA   NA

object.size(tmp)
[1] 1208

It means that a type check takes about 0.0002 seconds on a P4 3000 Windows XP with hyperthreding. Its not much.
It means thats no reason to be scared of S4 because of performance. The overhad is even less 0.00002

Last but not least:  There where also some discussions about having the OPTION to pass arguments to function by reference.

Sincerely
Eryk

Ps.:
The UseR conference was great!
Thanks to the organizers from me too.



*********** REPLY SEPARATOR ***********

On 5/27/2004 at 10:55 PM Torsten Steuernagel wrote:

>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

Dipl. bio-chem. Eryk Witold Wolski    @    MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin       'v'
tel: 0049-30-83875219               /   \
mail: wolski@molgen.mpg.de        ---W-W----    http://www.molgen.mpg.de/~wolski


	[[alternative HTML version deleted]]


