[Rd] standardization of slot access

Roger Bivand Roger.Bivand at nhh.no
Wed Sep 27 08:26:10 CEST 2006


On Tue, 26 Sep 2006, Sebastian P. Luque wrote:

> Thank you all for your comments, which confirm the feeling I had that
> 'slot' is only needed in the rare occasions Roger mentioned.  Although
> 'slot' is an accessor function, it seems it's not quite analogous to
> functions or methods for accessing components of objects.
> 

I find that slot() is useful in explaining to users what is going on. I 
also find that used inside s/lapply that say function(x) slot(x, "y") is a 
natural way to access contents of lists of objects. So I wouldn't conclude 
that it is only rarely used, and would recommend its use in explaining to 
students/users what is going on in new-style objects.

Roger

> 
> Cheers,
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-devel mailing list