[R] "privileged slots"
John Chambers
jmc at research.bell-labs.com
Tue Jun 1 16:39:55 CEST 2004
(I'm picking up this thread after it started, so may be unaware of some
contributions).
>
> Matthias> Martin Maechler schrieb:
> >>>>>>> "Matthias" == Matthias Kohl
> >>>>>>> <Matthias.Kohl at uni-bayreuth.de> on Thu, 27 May 2004
> >>>>>>> 14:01:51 +0100 writes:
> >>>>>>>
> >>>>>>>
> >>
> Matthias> Hi all, in the help for RClassUtils I found the
> Matthias> expression "privileged slots" in function
> Matthias> "checkSlotAssignment" with the explanation:
> >>
> Matthias> /privileged slots (those that can only be set by
> Matthias> accesor functions defined along with the class
> Matthias> itself)/
> >>
> >>
> >> RClassUtils ???
> >>
> >> > help.search("RClassUtils")
> >>
> >>
> Matthias> your right, sorry
>
> Matthias> but, at least a R Site search in "Functions" gives
> Matthias> me one match: "Utilities for Managing Class
> Matthias> Definitions" which hast the "title":
> Matthias> RClassUtils{methods} R Documentation
>
> >> No help files found with alias or concept or title
> >> matching 'RClassUtils' using fuzzy matching.
> >>
> >> -----
> >>
> >> So I guess that's not something in a standard R document.
> >> You should rather keep to the 'official documentation'
> >> ...
> >>
> >>
> Matthias> I thought this is a official documentation ...
Not really. It's internal documentation, not meant to be visible. So
it doesn't get as much attention as perhaps it should. Better to use
the public documentation (see below).
>
> Matthias> I thought all slots of a (not private) class can
> Matthias> be a accessed by a user via the @ Operator.
> >> I tend to agree with your thoughts...
> >>
> Matthias> Is there a way to make a single slot of a class
> Matthias> (not the whole class) private, so that you can
> Matthias> access this slot only via an accessor function
> Matthias> (not via @)?
> >> I'd rather guess not.
The current situation is that slot access is just done by slot name, so
anything that can be found is allowed.
In the original design of S4 classes, there was provision for specifying
access when setClass was called. This was never implemented and in fact
is not in the Programming with Data book, as far as I know.
The access= argument was retained in setClass for portability, but the
"official" documentation in ?setClass says:
access: Access list for the class. Saved in the definition, but not
currently used.
That's the safer place to look for information.
It is possible, but not very likely, that access lists might be revived
if the underlying mechansim for slot access is changed.
John Chambers
> >>
> Matthias> Thanks, for your help Matthias
> >> Martin
>
> _______________________________________________
> R-core list: https://www.stat.math.ethz.ch/mailman/listinfo/r-core
--
John M. Chambers jmc at bell-labs.com
Bell Labs, Lucent Technologies office: (908)582-2681
700 Mountain Avenue, Room 2C-282 fax: (908)582-3340
Murray Hill, NJ 07974 web: http://www.cs.bell-labs.com/~jmc
More information about the R-help
mailing list