\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#354: Minor Production-Driven TclOO Revisions}
\date{August 26, 2009}
\author{Donal K. Fellows}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#354}&\textbf{Minor Production-Driven TclOO Revisions}\\\hline
Author&

Donal K. Fellows \tipmail{dkf}{users.sf.net}
\\
Created&Wednesday, \(\text{26}^{\text{th}}\) August 2009\\
Type&Project\\
Tcl Version&\(8.6\)\\
State&Final\\
Vote&Done\\
Version&\tipversion$Revision: 1.4 $\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This TIP describes a few small changes required for solving issues that have been found when using TclOO in production.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Description}

TclOO (see \cite{tip257}) has now had a substantial amount of use for relatively complex functionality (as well as production deployment) and it has turned out that there were a few small changes required.
\begin{enumerate}
\item{}
The scope of resolution for the target of a \textbf{forward}ed method is updated so that it is with respect to the object's namespace. This means that a class may create methods that forward to a command given by each instance, which makes creating megawidgets by wrapping real Tk widgets much easier, since the forwards do not have to be created at the instance level.
\setcounter{enumi}{1}
\item{}
A subcommand was added to \textbf{info object} to allow the discovery of the namespace of an object by code outside that object. This makes it far easier for code that needs to ``break the abstraction'' to do so, which turns out to be necessary for things like serialization. This subcommand, \textbf{namespace}, takes an object name as its only argument and returns the name of the object's namespace.

To expand on the requirements for serialization, the serialization code needs to call a method on each object to create the serialization for that object. However, the method should not be part of the public API for the object as it cannot perform a complete serialization correctly, since the serialization depends on the rest of the object graph. (It also requires a number of global overheads that are best applied once, not repeatedly.)

Note that I plan to release the serialization code itself (originally developed as part of a solution for a Rosetta Code task) as a package via tcllib. This TIP does not propose its inclusion with Tcl.
\setcounter{enumi}{2}
\item{}
A new C API function has been added to allow code at that level to \textit{efficiently} discover the name of an object that it already has a handle to. This new function, \textbf{Tcl\_GetObjectName}, returns a shared Tcl\_Obj reference to the name that needs no special reference count management.
\end{enumerate}

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\begin{thebibliography}{TIP \#1}
\addcontentsline{toc}{section}{References}
\bibitem[TIP \#257]{tip257}
Donal K. Fellows,
Will Duquette,
Steve Landers,
Jeff Hobbs,
Kevin Kenny,
Miguel Sofer,
Richard Suchenwirth,
Larry W. Virden,
\emph{Object Orientation for Tcl},
on-line at \url{http://purl.org/tcl/tip/257.html}
\end{thebibliography}
\end{document}
