Index: doc/generic_types/generic_types.tex
===================================================================
--- doc/generic_types/generic_types.tex	(revision 53f94480077dfb0e3bf795429d3545d35a0dc246)
+++ doc/generic_types/generic_types.tex	(revision ea73caf618e36e68d559d772dc6888ac79d824e9)
@@ -51,5 +51,5 @@
 %mathescape=true,										% LaTeX math escape in CFA code $...$
 escapechar=\$,											% LaTeX escape in CFA code
-%keepspaces=true,										%
+keepspaces=true,										%
 showstringspaces=false,									% do not show spaces with cup
 showlines=true,											% show blank lines at end of code
@@ -167,7 +167,7 @@
 \begin{lstlisting}
 forall( otype T `| { int ?<?( T, T ); }` )	$\C{// type assertion}$
-  void qsort( const T * arr, size_t dimension );
+  void qsort( const T * arr, size_t dim );
 forall( otype T `| { int ?<?( T, T ); }` )	$\C{// type assertion}$
-  T * bsearch( T key, const T * arr, size_t dimension );
+  T * bsearch( T key, const T * arr, size_t dim );
 double vals[10] = { /* 10 floating-point values */ };
 qsort( vals, 10 );							$\C{// sort array}$
@@ -179,26 +179,24 @@
 Crucial to the design of a new programming language are the libraries to access thousands of external features.
 \CFA inherits a massive compatible library-base, where other programming languages have to rewrite or provide fragile inter-language communication with C.
-A simple example is leveraging the existing type-unsafe C @bsearch@:
+A simple example is leveraging the existing type-unsafe (@void *@) C @bsearch@, shown here searching a floating-point array:
 \begin{lstlisting}
 void * bsearch( const void * key, const void * base, size_t nmemb, size_t size,
-                     int (* compar)(const void *, const void *));
+				int (* compar)(const void *, const void *));
 int comp( const void * t1, const void * t2 ) { return *(double *)t1 < *(double *)t2 ? -1 :
-					 *(double *)t2 < *(double *)t1 ? 1 : 0; }
-double key = ...;
-double *v = (double *)bsearch( &key, vals, size, sizeof( vals[0] ), comp );
+				*(double *)t2 < *(double *)t1 ? 1 : 0; }
+double key = 5.0;
+double * val = (double *)bsearch( &key, vals, size, sizeof(vals[0]), comp );
 \end{lstlisting}
 but providing a type-safe \CFA overloaded wrapper.
 \begin{lstlisting}
-forall( otype T | { int ?<?( T, T ); } )
-  T * bsearch( T key, const T * arr, size_t dimension ) {
+forall( otype T | { int ?<?( T, T ); } ) T * bsearch( T key, const T * arr, size_t dim ) {
 	int comp( const void * t1, const void * t2 ) { /* as above with double changed to T */ }
-	return (T *)bsearch( &key, arr, dimension, sizeof(T), comp );
-}
-forall( otype T | { int ?<?( T, T ); } )
-  unsigned int bsearch( T key, const T * arr, size_t dimension ) {
-	T *result = bsearch( key, arr, dimension );	$\C{// call first version}$
-	return result ? result - arr : dimension;	$\C{// pointer subtraction includes sizeof(T)}$
-}
-double * val = bsearch( 5.0, vals, 10 );		$\C{// selection based on return type}$
+	return (T *)bsearch( &key, arr, dim, sizeof(T), comp );
+}
+forall( otype T | { int ?<?( T, T ); } ) unsigned int bsearch( T key, const T * arr, size_t dim ) {
+	T *result = bsearch( key, arr, dim );	$\C{// call first version}$
+	return result ? result - arr : dim;		$\C{// pointer subtraction includes sizeof(T)}$
+}
+double * val = bsearch( 5.0, vals, 10 );	$\C{// selection based on return type}$
 int posn = bsearch( 5.0, vals, 10 );
 \end{lstlisting}
@@ -209,6 +207,5 @@
 Call-site inferencing and nested functions provide a localized form of inheritance. For example, @qsort@ only sorts in ascending order using @<@. However, it is trivial to locally change this behaviour:
 \begin{lstlisting}
-{
-	int ?<?( double x, double y ) { return x `>` y; }	$\C{// override behaviour}$
+{   int ?<?( double x, double y ) { return x `>` y; }	$\C{// override behaviour}$
 	qsort( vals, size );					$\C{// descending sort}$
 }
@@ -217,6 +214,8 @@
 Hence, programmers can easily form new local environments to maximize reuse of existing functions and types.
 
-Finally, variables can also be overloaded:
-
+Finally, variables may be overloaded:
+\lstDeleteShortInline@
+\par\smallskip
+\begin{tabular}{@{}l@{\hspace{\parindent}}|@{\hspace{\parindent}}l@{}}
 \begin{lstlisting}
 short int MAX = ...;
@@ -224,4 +223,5 @@
 double MAX = ...;
 \end{lstlisting}
+&
 \begin{lstlisting}
 short int s = MAX;  // select correct MAX
@@ -229,5 +229,8 @@
 double d = MAX;
 \end{lstlisting}
-
+\end{tabular}
+\lstMakeShortInline@
+\smallskip\par\noindent
+Hence, the single name @MAX@ replaces all the C type-specific names: @SHRT_MAX@, @INT_MAX@, @DBL_MAX@.
 
 \subsection{Traits}
@@ -259,7 +262,7 @@
 };
 forall( otype T | summable( T ) )
-  T sum( T a[$\,$], size_t dimension ) {
+  T sum( T a[$\,$], size_t dim ) {
 	T total = { 0 };							$\C{// instantiate T from 0}$
-	for ( unsigned int i = 0; i < dimension; i += 1 )
+	for ( unsigned int i = 0; i < dim; i += 1 )
 		total += a[i];						$\C{// select appropriate +}$
 	return total;
