\Header{.Alias}{Create ``Alias'' (Pointer) to \R Object}
\keyword{programming}{.Alias}
\begin{Usage}
\begin{verbatim}
new <- .Alias(expr)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{expr}] an \R\ expression; typically a name.
\item[\texttt{new}] new name by which \texttt{expr} can be accessed.
\end{ldescription}
\end{Arguments}
\begin{Description}
\texttt{.Alias} creates an \bold{alias} to another (part of) an \R
object which is more (memory-) efficient than usual assignment.\end{Description}
\begin{Value}
\emph{an identical copy} of \texttt{expr}.\end{Value}
\begin{Section}{WARNING}
This has a \bold{dangerous} semantic, and consequences can be
unexpected (it can be used to defeat the call-by-value illusion).
Know what you are doing \emph{before} using \texttt{.Alias}!\end{Section}
\begin{SeeAlso}
\texttt{\Link{<-}} for usual assignments.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
mop <- options()
Op <- .Alias(mop)
## A change to mop is reflected in Op and vice versa
## -- ONLY if no new slots are created ...
mop $ digits <- "Wow!"
Op  $ browser <- "Web broser"
mop $ browser; Op $ digits
all(names(mop) == names(Op) &
    sapply(seq(mop), function(i) all(Op[[i]] == mop[[i]])))
##> TRUE -- Op and mop  *ARE* the same thing !

mop $ newslot <- pi #--->> 'newslot' ==> (shallow) COPY of 'mop'
 Op $ newslot# R (>= 0.63): still the old one, i.e. NULL
all(names(mop) == names(Op))# no longer TRUE [R >= 0.63]
\end{ExampleCode}
\end{Examples}

