\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#4: Tcl Release and Distribution Philosophy}
\date{October 26, 2000}
\author{Brent Welch, Donal K. Fellows, Larry W. Virden, Larry W. Virden}
\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 \#4}&\textbf{Tcl Release and Distribution Philosophy}\\\hline
Author&

Brent Welch \tipmail{welch}{acm.org}
\par
Donal K. Fellows \tipmail{fellowsd}{cs.man.ac.uk}
\par
Larry W. Virden \tipmail{lvirden}{cas.org}
\par
Larry W. Virden \tipmail{lvirden}{yahoo.com}
\\
Created&Thursday, \(\text{26}^{\text{th}}\) October 2000\\
Type&Informative\\
State&Draft\\
Vote&Pending\\
Version&\tipversion$Revision: 1.10 $\\
Post History&\\
Discussions To&news:comp.lang.tcl\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This document outlines how Tcl should be distributed, with particular reference to issues related to building a distribution with the \textit{batteries included} so that most people can have access to the useful extensions without having to chasing halfway across the 'net for them.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Overview}

Tcl has traditionally been a ``core'' that is extensible with binary extensions and Tcl scripts. There have been two styles of Tcl distributions: source and binary. The Tcl source distribution contains the Tcl ``core'' and a small number of support scripts. The binary distributions have included Tk, and in some cases (e.g., TclPro) other extensions like [incr Tcl], TclX, and Expect. Users with access to a compiler can get source distributions of the various extensions and compile them for their own installation. \textit{(Thanks to Bob Technetin \tipmail{techentin.robert}{mayo.edu} for the inspiration for these pictures --- DKF.)}

\begin{figure}[htbp]\begin{center}\leavevmode
\tipimage{4layers1}{311pt}
\caption{Traditional Tcl Distribution Architecture}
\end{center}\end{figure}

This proposal formalizes the notion of a small Tcl source core and larger distribution bundle that includes one or many extensions. The distribution can be in source or binary form. The goal is to keep a small core that is suitable for embedding with the smallest footprint, while acknowleding that desktop users and application developers want a larger \textit{standard distribution} that has a set of well known and widely used extensions.

The goal of this proposal is to establish a standard for future Tcl distributions. There will be two kinds of Tcl distributions: a small core suitable for specialized embedded applications, and a larger bundled distribution suitable for more general application development.

\begin{figure}[htbp]\begin{center}\leavevmode
\tipimage{4layers2}{311pt}
\caption{Batteries-Included Tcl Distribution Architecture}
\end{center}\end{figure}

\section{The Tcl Core Distribution}

The Tcl ``core'' should remain as small as possible, and could become smaller in the future as certain features are moved into extensions. The ``core'' distribution must include:
\begin{enumerate}
\item{}
The C sources required to create the Tcl binary library.
\item{}
The C sources required to create a ``Tcl Shell'' application. This is commonly known as ``tclsh''.
\item{}
The Tcl script libraries that implement the code library and packaging systems. This includes the ``unknown'' command and various commands related to auto loading of packages.
\item{}
The Tcl test framework used for testing the Tcl binary library and the support scripts.
\end{enumerate}

Additional items may appear in the ``core'' distribution, especially for historical reasons. But, some Tcl scripts and binary extensions that currently exist (as of Tcl 8.3) in the Tcl source distributions may migrate into the larger distribution described below.

\section{The Bundled Distribution}

The \textit{bundled} Tcl distribution will contain Tcl, various binary extensions, and various Tcl script packages. This proposal establishes an initial set of binary extensions, but following the model and using the distribution infrastructure we create, various bundles should be easily created.

Each package included in the bundled distribution must have a test suite and documentation. At this stage the documentation will probably be in a variety of formats, but ultimately we should standardize on an XML-based representation and supply tools that generate other formats from that representation.

\section{Mandatory Packages}

The bundled distribution must include (but is not limited to):
\begin{enumerate}
\item{}
The ``core'' distribution described above.
\item{}
The Tk toolkit for GUI applications. This includes the well known ``wish'' shell application.
\item{}
The registry and dde extensions for the Windows platform.
\item{}
The [incr Tcl] extension. 
\item{}
The TclX extension. There are some historical features of TclX that should not necessarily be included, including the tclx shell and its alternate library format. However, the TclX help system should not only be included, but updated to include info on all commands included in the distribution.
\item{}
The Expect extension for UNIX platforms.
\item{}
The TkCon enhanced console application.
\end{enumerate}

\section{Optional Packages}

In addition, it is likely that several of the following packages will be included in the bundled distribution, as well as others not listed.
\begin{enumerate}
\item{}
The Standard Tcl Library of Tcl scripts. Currently this includes packages for:
\begin{enumerate}
\item{}
base64 encoding/decoding
\item{}
file utilities
\item{}
command line processing
\item{}
FTP client library
\item{}
FTP server
\item{}
HTML and JavaScript generation
\item{}
Math and statistics utilities
\item{}
MIME encoder and parser
\item{}
CGI processing (ncgi)
\item{}
NNTP client
\item{}
POP3 client
\item{}
Profiler for Tcl scripts
\item{}
Event counters and interval timers
\item{}
Structures, including tree, stack, graph, queue
\item{}
URI parsing
\item{}
Text string manipulation utilities (trim, tab, etc.)
\end{enumerate}
\item{}
BLT.
\item{}
[incr Tk] and [incr Widgets].
\item{}
TkTable.
\item{}
The Standard Tk Library of Tcl/Tk scripts. Currently this includes packages for:
\begin{enumerate}
\item{}
BWidgets
\item{}
mclistbox
\end{enumerate}
\item{}
Img
\end{enumerate}

\section{Rationale}

The small ``core'' distribution must retain its identity for those applications that embed the Tcl interpreter into constrained environments and require a small footprint. The footprint must remain small, and in fact it should grow smaller, if possible. For example, in the early days of Tcl it was possible at compile time to remove all the file system and exec commands to create a very small Tcl core. There are wide variety of vendors that embed Tcl into, e.g., CAD applications, router firmware, and other limited environments. They only need the basic commands for procedural programming and basic data types.

The larger, bundled distribution must become the standard for desktop distributions (e.g., Linux) so that application writers have a richer set of Tcl commands that they can assume are available. This includes the [incr Tcl] class system and the OS-specific commands provided the TclX and the registry and dde extensions.

The set of packages in the bundled distribution are divided into \textit{mandatory} and \textit{optional} packages. The intent of this distinction is to set a goal for the initial \textit{bundled} distribution, but not close the door to inclusion of other packages. Over time the set of packages in the bundled distribution will surely grow, and some packages may become superceeded by other better packages. The \textit{mandatory set} of packages, however, should be common among all bundles to application writers know what to expect.

In particular, the mandatory set includes [incr Tcl] to promote object oriented programming, Tk to promote easy GUI development, TclX, Dde and Registry to provide access to OS-dependent functionality, and Expect to support automated test environments.

At this time there are a variety of Tk widgets that are optional because there is some overlap and we anticipate continuted evolution of the Tk widget set. I expect that the first bundle will include all the major widget sets, including BLT, [incr Tk] and [incr Widgets], TkTable, the ``vu'' collection, and possibly Tix.

\section{The Role of the TCT}

The larger bundled distribution will contain packages that are ``owned'' by the TCT and some that are not. The whole process will be more scalable if responsibility for packages can be split out to other individuals and groups. The role of the TCT should be to set up the infrastructure for the bundled distribution and to make \textit{official} bundled distributions.

\section{Issues}

The main purpose of this proposal is to establish three things:
\begin{enumerate}
\item{}
The continued existence of a small Tcl ``core'' that is identifiable unto its own and useful to various specialized embedded applications.
\item{}
The creation of infrastructure to create bundled distributions. The exact nature of this bundling is not specified. The first bundles may well be created by hand crafted Makefiles and distribution-creation scripts.
\item{}
The set of \textit{mandatory} extensions that should be included in any Tcl bundle. The list in the first draft of this TIP is likely to be wrong, and will surely be amended in the future.
\item{}
Whether further distinctions should be introduced to better support people who wish to target Tcl towards small devices or embedded environments better.
\end{enumerate}

\begin{figure}[htbp]\begin{center}\leavevmode
\tipimage{4layers3}{324pt}
\caption{Refined Tcl Distribution Architecture}
\end{center}\end{figure}

There are a number of related topics that are deliberately outside the scope of this TIP:
\begin{enumerate}
\item{}
Documentation format. 
\item{}
Network aware downloading of packages and more sophisticated package management.
\item{}
Details of the compile and build environment. Currently there is the TEA standard, and the packages listed in the Mandatory set have all been set up for TEA as part of TclPro.
\end{enumerate}

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

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