On 28 May 2004 at 15:09, Wolski wrote:

> The simplest way to find the document is
> ?checkSlotAssignmen

Thanks, I finally found it.

> 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.

Yes, I found that one as well. Now I see what your original concern 
was. I didn't realize that you were talking about the "check" argument 
of "slot<-". Anyway, it's still true that "@<-" adds some overhead simply 
because it's a wrapper around "slot<-".
 
> 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.

I think most of them should be considered "internal" and may be 
subject to change. Also, the text says: "Most of them are rarely suitable 
to be called directly."
 
> There was a lot of discussion going on atabout 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. 

I haven't found anything in "Programming with Data" about 
performance issues or differences concerning "slot<-" and "@<-". 
Indeed, I can't find any hints that both should be different by any 
means (except that one can specify anything that evaluates to a slot 
name when using "slot<-"). At least, the language specification doesn't 
suggest such a difference in my opinion. My copy of S (S-PLUS 6.1 for 
Windows) shows that both are implemented identically in S:

> get("@<-") # or get("slot<-")
function(object, name, value)
.Call("do_AT_GETS", object, name, value)

So the difference between the two is R specific.

> (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 ofsome value
> because it allows to make some benchmarks.

Well, the "check" argument is documented in ?slot. Reading this, one 
can guess what it does without having to read the docs for 
checkSlotAssignment(). I agree that the description of 
checkSlotAssignment() is quite interesting because of this:

"For privileged slots (those that can only be set by accesor functions 
defined along with the class itself), ..."

Unfortunately, I haven't found any hints that privileged slots are 
implemented; and I wouldn't use them anyway as long as they aren't 
"officially" documented.
 
> I was running some test cases to figure out how many(much?) time one
> can gain by setting check=FALSE check=TRUE. 
> ...
> 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

Thanks for doing some tests here. The results don't surprise me; I 
didn't expect the operations performed by checkSlotAssignment() to be 
extraordinarily expensive. 
 
> Last but not least: There where also some discussions about having
> theOPTIONto pass arguments to function by reference.

That might be useful in some situations. I wonder how well this fits into 
the original language concept ?
 
BFN,

Torsten

        [[alternative HTML version deleted]]

______________________________________________
[EMAIL PROTECTED] 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

Reply via email to