\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#417: Use Explicit Option Names for "file tempfile"}
\date{November 16, 2012}
\author{Christophe Curis}
\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 \#417}&\textbf{Use Explicit Option Names for "file tempfile"}\\\hline
Author&

Christophe Curis \tipmail{christophe.curis}{free.fr}
\\
Created&Friday, \(\text{16}^{\text{th}}\) November 2012\\
Type&Project\\
Tcl Version&\(8.7\)\\
State&Draft\\
Vote&Pending\\
Version&\tipversion$Revision: 1.1 $\\
Keywords&Tcl, future expansion, extensibility\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This TIP proposes altering the way in which optional arguments are specified to \textbf{file tempfile} (see \cite{tip210}) to make them easier to understand and extend in the future.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Rationale}

The current documentation for \textbf{file tempfile} states that there are two optional arguments using a fixed order. This has some limits:
\begin{itemize}
\item{}
it is not possible to use the second argument without the first
\item{}
being an infrequently-used function, having a fixed order implies that a look to the manual page will be obligatory to make sure of the order
\item{}
this inhibits potential for any future expansion of the command.
\end{itemize}

Switching to option/value format will make the optional arguments easier to understand.

\section{Proposal}

The syntax of the command would be changed to:

\begin{quote}
\textbf{file tempfile} ?\textit{options...}?
\end{quote}

with supported \textit{options}:
\begin{itemize}
\item{}
\textbf{-namevar} \textit{variable}: Specifies a variable for receiving the file name.
\item{}
\textbf{-template} \textit{template}: Defines a template for the file name.
\end{itemize}

This syntax would allow:
\begin{itemize}
\item{}
easy extension in the future, as any option name can be added,
\item{}
ability to use any of the options in any order,
\item{}
an explicit syntax making the code easier to read and understand.
\end{itemize}

\section{Reference Implementation}

No implementation is available now, but the change is probably not complex; the priority have been placed on raising the subject before the release of the final 8.6 version of Tcl.

\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 \#210]{tip210}
Bob Techentin,
Donal K. Fellows,
\emph{Add 'tempfile' Subcommand to 'file'},
on-line at \url{http://purl.org/tcl/tip/210.html}
\end{thebibliography}
\end{document}
