\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#436: Improve TclOO isa Introspection}
\date{June 30, 2015}
\author{Donal 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 \#436}&\textbf{Improve TclOO isa Introspection}\\\hline
Author&

Donal Fellows \tipmail{dkf}{users.sf.net}
\\
Created&Tuesday, \(\text{30}^{\text{th}}\) June 2015\\
Type&Project\\
Tcl Version&\(8.6.5\)\\
State&Final\\
Vote&Done\\
Version&\tipversion$Revision: 1.3 $\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

The various \textbf{info object isa} introspectors should not produce errors when given a non-object; the set membership tests should simply return boolean false in those cases.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Rationale}

The \textbf{info object isa} command is intended to be used to allow asking whether some object is a member of a general set of entities; for example, \textbf{info object isa object} allows querying whether you actually have a handle to an object at all. However, the other membership sets all throw an error when given a non-object. This complicates the use of the API when all that is really needed is to return a \textbf{false} value in those cases.

Motivating example (with thanks to Will Duquette): is the \textbf{proc} a class? No. It's not even an object, so it clearly cannot be a class and so the following command should produce false (or 0) and not an error:
\begingroup\small\begin{verbatim}
 info object isa class proc
\end{verbatim}
\endgroup

\section{Proposed Change}

Where one of the \textbf{info object isa} introspectors:
\begin{itemize}
\item{}
\textbf{info object isa} \textit{class object}
\item{}
\textbf{info object isa metaclass} \textit{object}
\item{}
\textbf{info object isa mixin} \textit{object class}
\item{}
\textbf{info object isa object} \textit{object}
\item{}
\textbf{info object isa typeof} \textit{object class}
\end{itemize}

Would produce an error due to either the \textit{object} or (where appropriate) the \textit{class} object not passing some critical precondition to the test, the result of the command will be \textbf{0} (i.e., boolean false). Errors will be still generated when the wrong number of arguments are supplied.

Note that this rule is already followed by \textbf{info object isa object}.

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
