\Header{slot}{The Slots in an Object from a Formal Class}
\alias{@<\Rdash}{slot}
\alias{slot<\Rdash}{slot}
\alias{slotNames}{slot}
\keyword{programming}{slot}
\keyword{classes}{slot}
\begin{Description}\relax
These functions return or set information about the individual slots
in an object.\end{Description}
\begin{Usage}
\begin{verbatim}

object@name
object@name <- value

slot(object, name)
slot(object, name) <- value

slotNames(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] An object from a formally defined class.
\item[\code{name}] The character-string name of the slot. The name must be a valid
slot name:  see Details below.
\item[\code{value}] 
\item[\code{x}] Either the name of a class or an object from that class. Print
\code{\Link{getClass}(class)} to see the full description of the slots.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The \code{"@"} operator and the \code{slot} function extract or
replace the formally defined slots for the object.  The operator
takes a fixed name, which can be unquoted if it is syntactically a
name in the language.  A slot name can be any non-empty string, but
if the name is not made up of letters, numbers, and \code{"."}, it
needs to be quoted.

In the case of the \code{slot} function, the slot name can be any
expression that evaluates to a valid slot in the class definition.
Generally, the only reason to use the functional form rather than
the simpler operator is \emph{because} the slot name has to be computed.

The definition of the class contains the names of all slots diretly
and indirectly defined.  Each slot has a name and an associated
class.  Extracting a slot returns an object from that class.  Setting
a slot first coerces the value to the specified slot and then stores
it.

Unlike attributes, slots are not partially matched, and asking for (or
trying to set) a slot with an invalid name for that class generates an
error.\end{Details}
\begin{Author}\relax
John Chambers\end{Author}
\begin{References}\relax
Chambers, J. M. (1998)
\emph{Programming with Data}, Springer.

The web page \url{http://www.omegahat.org/RSMethods/index.html}
is the primary documentation.\end{References}
\begin{SeeAlso}\relax
\code{\Link{@}}, \code{\Link{Classes}}, \code{\Link{Methods}},
\code{\Link{getClass}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

  slot(myTrack, "x")
  slot(myTrack, "y") <- log(slot(myTrack, "x"))

  slotNames("track")
\end{ExampleCode}
\end{Examples}

