Index: doc/theses/jiada_liang_MMath/CFAenum.tex
===================================================================
--- doc/theses/jiada_liang_MMath/CFAenum.tex	(revision 09dd830d5391f11b3366f154f50709112d1ab25f)
+++ doc/theses/jiada_liang_MMath/CFAenum.tex	(revision b6923b1740ef731ae48dce4cce23151387f51e96)
@@ -7,18 +7,18 @@
 The following sections detail all of my new contributions to enumerations in \CFA.
 
-\begin{comment}
-	Not support. 
-\end{comment}
-% \section{Aliasing}
-
-% C already provides @const@-style aliasing using the unnamed enumerator \see{\VRef{s:TypeName}}, even if the name @enum@ is misleading (@const@ would be better).
-% Given the existence of this form, it is straightforward to extend it with types other than @int@.
-% \begin{cfa}
-% enum E { Size = 20u, PI = 3.14159L, Jack = L"John" };
-% \end{cfa}
-% which matches with @const@ aliasing in other programming languages.
-% Here, the type of the enumerator is the type of the initialization constant, \eg @typeof(20u)@ for @Size@ implies @unsigned int@.
-% Auto-initialization is restricted to the case where all constants are @int@, matching with C.
-% As seen in \VRef{s:EnumeratorTyping}, this feature is just a shorthand for multiple typed-enumeration declarations.
+
+\section{Aliasing}
+
+{\color{red}@***@}
+C already provides @const@-style aliasing using the unnamed enumerator \see{\VRef{s:TypeName}}, even if the keyword @enum@ is misleading (@const@ is better).
+However, given the existence of this form, it is straightforward to extend it with heterogeneous types, \ie types other than @int@.
+\begin{cfa}
+enum { Size = 20u, PI = 3.14159L, Jack = L"John" }; $\C{// not an ADT nor an enumeration}$
+\end{cfa}
+which matches with @const@ aliasing in other programming languages.
+(See \VRef{s:CenumImplementation} on how @gcc@/@clang@ are doing this for integral types.)
+Here, the type of each enumerator is the type of the initialization constant, \eg @typeof(20u)@ for @Size@ implies @unsigned int@.
+Auto-initialization is impossible in this case because some types do not support arithmetic.
+As seen in \VRef{s:EnumeratorTyping}, this feature is just a shorthand for multiple typed-enumeration declarations.
 
 
@@ -30,7 +30,11 @@
 
 The \CFA type-system allows extensive overloading, including enumerators.
-Furthermore, \CFA uses the environment, such as the left-had of assignment and function parameter, to pinpoint the best overloaded name. 
-% Furthermore, \CFA uses the left-hand of assignment in type resolution to pinpoint the best overloaded name.
-Finally, qualification and casting are provided to disambiguate any ambiguous situations.
+Furthermore, \CFA uses the environment, such as the left-hand of assignment and function arguments, to pinpoint the best overloaded name.
+\VRef[Figure]{f:EnumeratorVisibility} shows enumeration overloading and how qualification and casting are used to disambiguate ambiguous situations.
+\CFA overloading allows programmers to use the most meaningful names without fear of name clashes within a program or from external sources, like include files.
+Experience from \CFA developers is that the type system implicitly and correctly disambiguates the majority of overloaded names.
+That is, it is rare to get an incorrect selection or ambiguity, even among hundreds of overloaded variables and functions, that requires disambiguation using qualification or casting.
+
+\begin{figure}
 \begin{cfa}
 enum E1 { First, Second, Third, Fourth };
@@ -38,18 +42,18 @@
 E1 f() { return Third; }				$\C{// overloaded functions, different return types}$
 E2 f() { return Fourth; }
-void g(E1 e);
-void h(E2 e);
-void foo() {
+void g( E1 e );
+void h( E2 e );
+void foo() {							$\C{// different resolutions and dealing with ambiguities}$
 	E1 e1 = First;   E2 e2 = First;		$\C{// initialization}$
 	e1 = Second;   e2 = Second;			$\C{// assignment}$
 	e1 = f();   e2 = f();				$\C{// function return}$
-	g(First); h(First);					$\C{// function parameter}$
+	g( First );   h( First );			$\C{// function argument}$
 	int i = @E1.@First + @E2.@First;	$\C{// disambiguate with qualification}$
 	int j = @(E1)@First + @(E2)@First;	$\C{// disambiguate with cast}$
 }
 \end{cfa}
-\CFA overloading allows programmers to use the most meaningful names without fear of name clashes within a program or from external sources, like include files.
-Experience from \CFA developers is that the type system implicitly and correctly disambiguates the majority of overloaded names, \ie it is rare to get an incorrect selection or ambiguity, even among hundreds of overloaded variables and functions.
-Any ambiguity can be resolved using qualification or casting.
+\caption{Enumerator Visibility and Disambiguating}
+\label{f:EnumeratorVisibility}
+\end{figure}
 
 
@@ -68,5 +72,5 @@
 rgb = @RGB.@Blue;
 \end{cfa}
-It is possible to toggle back to unscoping using the \CFA @with@ clause/statement (see also \CC \lstinline[language=c++]{using enum} in Section~\ref{s:C++RelatedWork}).
+{\color{red}@***@}It is possible to toggle back to unscoped using the \CFA @with@ clause/statement (see also \CC \lstinline[language=c++]{using enum} in Section~\ref{s:C++RelatedWork}).
 \begin{cfa}
 with ( @Week@, @RGB@ ) {				$\C{// type names}$
@@ -78,140 +82,5 @@
 
 
-\section{Enumeration Traits}
-
-\CFA defines the set of traits containing operators and helper functions for @enum@.
-A \CFA enumeration satisfies all of these traits allowing it to interact with runtime features in \CFA.
-Each trait is discussed in detail.
-
-The trait @CfaEnum@:
-\begin{cfa}
-forall( E ) trait CfaEnum {
-	char * label( E e );
-	unsigned int posn( E e );
-};
-\end{cfa}
-
-describes an enumeration as a named constant with position. And @TypeEnum@
-\begin{cfa}
-forall( E, V ) trait TypeEnum {
-	V value( E e );
-};	
-\end{cfa}
-asserts two types @E@ and @T@, with @T@ being the base type for the enumeration @E@. 
-
-The declarative syntax
-\begin{cfa}
-enum(T) E { A = ..., B = ..., C = ... };
-\end{cfa}
-creates an enumerated type E with @label@, @posn@ and @value@ implemented automatically.
-
-\begin{cfa}
-void foo( T t ) { ... }
-void bar(E e) {
-	choose (e) {
-		case A: printf("\%d", posn(e));
-		case B: printf("\%s", label(e));
-		case C: foo(value(e));
-	} 
-}
-\end{cfa}
-
-Implementing general functions across all enumeration types is possible by asserting @CfaEnum( E, T )@, \eg:
-\begin{cfa}
-#include <string.hfa>
-forall( E, T | CfaEnum( E, T ) | {unsigned int toUnsigned(T)} )
-string formatEnum( E e ) {
-	unsigned int v = toUnsigned(value(e));
-	string out = label(e) + '(' + v +')';
-	return out;
-}
-printEunm( Week.Mon );
-printEnum( RGB.Green );
-\end{cfa}
-
-\CFA does not define attribute functions for C style enumeration. But it is possilbe for users to explicitly implement
-enumeration traits for C enum and any other types.
-
-\begin{cfa}
-enum Fruit { Apple, Bear, Cherry };			$\C{// C enum}$
-char * label(Fruit f) {
-	switch(f) {
-		case Apple: "A"; break;
-		case Bear: "B"; break;
-		case Cherry: "C"; break;
-	}
-}
-unsigned posn(Fruit f) { return f; }
-char* value(Fruit f) { return ""; } 		$\C{// value can return any non void type}$
-formatEnum( Apple );							$\C{// Fruit is now a Cfa enum}$
-\end{cfa}
-
-A type that implements trait @CfaEnum@, \ie, a type has no @value@, is called an opaque enum.
-
-% \section{Enumerator Opaque Type}
-
-% \CFA provides a special opaque enumeration type, where the internal representation is chosen by the compiler and only equality operations are available.
-\begin{cfa}
-enum@()@ Planets { MERCURY, VENUS, EARTH, MARS, JUPITER, SATURN, URANUS, NEPTUNE };
-\end{cfa}
-
-
-In addition, \CFA implements @Bound@ and @Serial@ for \CFA Enums.
-\begin{cfa}
-forall( E ) trait Bounded {
-	E first();
-	E last();
-};
-\end{cfa}
-The function @first()@ and @last()@ of enumerated type E return the first and the last enumerator declared in E, respectively. \eg:
-\begin{cfa}
-Workday day = first();					$\C{// Mon}$
-Planet outermost = last();				$\C{// NEPTUNE}$
-\end{cfa}
-@first()@ and @last()@ are overloaded with return types only, so in the example, the enumeration type is found on the left-hand side of the assignment.
-Calling either functions without a context results in a type ambiguity, except in the rare case where the type environment has only one enumeration.
-\begin{cfa}
-@first();@								$\C{// ambiguous because both Workday and Planet implement Bounded}$
-sout | @last()@;
-Workday day = first();					$\C{// day provides type Workday}$
-void foo( Planet p );
-foo( last() );							$\C{// parameter provides type Planet}$
-\end{cfa}
-
-The trait @Serial@:
-\begin{cfa}
-forall( E | Bounded( E ) ) trait Serial {
-	unsigned fromInstance( E e );
-	E fromInt( unsigned int posn );
-	E succ( E e );
-	E pred( E e );
-};
-\end{cfa}
-is a @Bounded@ trait, where elements can be mapped to an integer sequence.
-A type @T@ matching @Serial@ can project to an unsigned @int@ type, \ie an instance of type T has a corresponding integer value.
-%However, the inverse may not be possible, and possible requires a bound check.
-The mapping from a serial type to integer is defined by @fromInstance@, which returns the enumerator's position.
-The inverse operation is @fromInt@, which performs a bound check using @first()@ and @last()@ before casting the integer into an enumerator.
-Specifically, for enumerator @E@ declaring $N$ enumerators, @fromInt( i )@ returns the $i-1_{th}$ enumerator, if $0 \leq i < N$, or raises the exception @enumBound@.
-
-The @succ( E e )@ and @pred( E e )@ imply the enumeration positions are consecutive and ordinal. 
-Specifically, if @e@ is the $i_{th}$ enumerator, @succ( e )@ returns the $i+1_{th}$ enumerator when $e \ne last()$, and @pred( e )@ returns the $i-1_{th}$ enumerator when $e \ne first()$. 
-The exception @enumRange@ is raised if the result of either operation is outside the range of type @E@.
-
-Finally, there is an associated trait defining comparison operators among enumerators. 
-\begin{cfa}
-forall( E, T | CfaEnum( E, T ) ) {
-	// comparison
-	int ?==?( E l, E r ); 		$\C{// true if l and r are same enumerators}$
-	int ?!=?( E l, E r ); 		$\C{// true if l and r are different enumerators}$
-	int ?!=?( E l, zero_t ); 	$\C{// true if l is not the first enumerator}$
-	int ?<?( E l, E r ); 		$\C{// true if l is an enumerator before r}$
-	int ?<=?( E l, E r ); 		$\C{// true if l before or the same as r}$
-	int ?>?( E l, E r ); 		$\C{// true if l is an enumerator after r}$
-	int ?>=?( E l, E r ); 		$\C{// true if l after or the same as r}$         
-}
-\end{cfa}
-
-\section{Typed Enum}
+\section{Enumerator Typing}
 \label{s:EnumeratorTyping}
 
@@ -251,7 +120,7 @@
 	int i, j, k;
 	enum( @int *@ ) ptr { I = &i,  J = &j,  K = &k };
-	enum( @int &@ ) ref { I = i,   J = j,   K = k };
+@***@enum( @int &@ ) ref { I = i,   J = j,   K = k };
 // tuple
-	enum( @[int, int]@ ) { T = [ 1, 2 ] }; $\C{// new \CFA type}$
+@***@enum( @[int, int]@ ) { T = [ 1, 2 ] }; $\C{// new \CFA type}$
 // function
 	void f() {...}   void g() {...}
@@ -281,14 +150,92 @@
 calling constructors happens at runtime (dynamic).
 
+
+\section{Opaque Enumeration}
+
+\CFA provides a special opaque (pure) enumeration type with only assignment and equality operations, and no implicit conversion to any base-type.
+\begin{cfa}
+enum@()@ Mode { O_RDONLY, O_WRONLY, O_CREAT, O_TRUNC, O_APPEND };
+Mode mode = O_RDONLY;
+if ( mode == O_CREAT ) ...
+bool b = mode == O_RDONLY || mode @<@ O_APPEND; $\C{// disallowed}$
+int www @=@ mode;						$\C{// disallowed}$
+\end{cfa}
+
+
+\section{Enumeration Operators}
+
+
+\subsection{Conversion}
+
+\CFA only proves an implicit safe conversion between an enumeration and its base type (like \CC), whereas C allows an unsafe conversion from base type to enumeration.
+\begin{cfa}
+enum(int) Colour { Red, Blue, Green };
+int w = Red;		$\C[1.5in]{// allowed}$
+Colour color = 0;	$\C{// disallowed}\CRT$
+\end{cfa}
+Unfortunately, there must be one confusing case between C enumerations and \CFA enumeration for type @int@.
+\begin{cfa}
+enum Colour { Red = 42, Blue, Green };
+enum(int) Colour2 { Red = 16, Blue, Green };
+int w = Redy;		$\C[1.5in]{// 42}\CRT$
+\end{cfa}
+Programmer intuition is that the assignment to @w@ is ambiguous.
+However, converting from @color@ to @int@ is zero cost (no conversion), while from @Colour2@ to @int@ is a safe conversion, which is a higher cost.
+This semantics means fewer backwards-compatibility issues with overloaded C and \CFA enumerators.
+
+
+\subsection{Properties}
+
+\VRef{s:Terminology} introduced three fundamental enumeration properties: label, position, and value.
+\CFA provides direct access to these three properties via the functions: @label@, @posn@, and @value@.
+\begin{cfa}
+enum( const char * ) Name { Fred = "FRED", Mary = "MARY", Jane = "JANE" };
+Name name = Fred;
+sout | name | label( name ) | posn( name ) | value( name );
+FRED Fred 0 FRED
+\end{cfa}
+The default meaning for an enumeration variable in an expression is its value.
+
+
+\subsection{Range}
+
+The following helper function are used to access and control enumeration ranges (enumerating).
+
+The pseudo-function @countof@ (like @sizeof@) provides the size (range) of an enumeration or an enumeration instance.
+\begin{cfa}
+enum(int) Colour { Red, Blue, Green };
+Colour c = Red
+sout | countof( Colour ) | countof( c );
+3 3
+\end{cfa}
+@countof@ is a pseudo-function because it takes a type as an argument.
+The function @fromInt@ provides a safe subscript of the enumeration.
+\begin{cfa}
+Colour r = fromInt( prng( countof( Colour ) ) ); // select random colour
+\end{cfa}
+The functions @lowerBound@, @upperBound@, @succ@, and @pred@ are for enumerating.
+\begin{cfa}
+for ( Colour c = lowerBound();; ) {
+	sout | c | nonl;
+  if ( c == upperBound() ) break;
+	c = succ( c );
+}
+\end{cfa}
+Note, the mid-exit loop is necessary to prevent triggering a @succ@ bound check, as in:
+\begin{cfa}
+for ( Colour c = lowerBound(); c <= upperBound(); c = succ( c ) ) ... // generates error
+\end{cfa}
+When @c == upperBound()@, the loop control still invokes @succ( c )@, which causes an @enumBound@ exception.
+Finally, there is operational overlap between @countof@ and @upperBound@.
+
+
 \section{Enumeration Inheritance}
 
 \CFA Plan-9 inheritance may be used with enumerations, where Plan-9 inheritance is containment inheritance with implicit unscoping (like a nested unnamed @struct@/@union@ in C).
-
-\begin{cfa}
-enum( char * ) Names { /* as above */ };
-enum( char * ) Names2 { @inline Names@, Jack = "JACK", Jill = "JILL" };
-enum( char * ) Names3 { @inline Names2@, Sue = "SUE", Tom = "TOM" };
-\end{cfa}
-
+\begin{cfa}
+enum( const char * ) Names { Fred = "FRED", Mary = "MARY", Jane = "JANE" };
+enum( const char * ) Names2 { @inline Names@, Jack = "JACK", Jill = "JILL" };
+enum( const char * ) Names3 { @inline Names2@, Sue = "SUE", Tom = "TOM" };
+\end{cfa}
 Enumeration @Name2@ inherits all the enumerators and their values from enumeration @Names@ by containment, and a @Names@ enumeration is a subtype of enumeration @Name2@.
 Note, that enumerators must be unique in inheritance but enumerator values may be repeated.
@@ -299,11 +246,15 @@
 Specifically, the inheritance relationship for @Names@ is:
 \begin{cfa}
-Names $\(\subset\)$ Names2 $\(\subset\)$ Names3 $\C{// enum type of Names}$
-\end{cfa}
-A subtype can be cast to its supertype, assigned to a supertype variable, or be used as a function argument that expects the supertype.
-\begin{cfa}
-Names fred = Name.Fred;
-(Names2) fred; (Names3) fred; (Name3) Names.Jack;  $\C{// cast to super type}$
-Names2 fred2 = fred; Names3 fred3 = fred2; $\C{// assign to super type}$
+Names  $\(\subset\)$  Names2  $\(\subset\)$  Names3  $\C{// enum type of Names}$
+\end{cfa}
+A subtype can be cast to its supertype, assigned to a supertype variable, or used as a function argument that expects the supertype.
+\begin{cfa}
+Names fred = Names.Fred;
+(Names2)fred;   (Names3)fred;   (Names3)Names2.Jack;  $\C{// cast to super type}$
+Names2 fred2 = fred;   Names3 fred3 = fred2;	$\C{// assign to super type}$
+\end{cfa}
+As well, there is the implicit cast to an enumerator's base-type.
+\begin{cfa}
+const char * name = fred;
 \end{cfa}
 For the given function prototypes, the following calls are valid.
@@ -327,4 +278,5 @@
 Note, the validity of calls is the same for call-by-reference as for call-by-value, and @const@ restrictions are the same as for other types.
 
+
 \section{Enumerator Control Structures}
 
@@ -335,11 +287,14 @@
 
 For example, an intuitive use of enumerations is with the \CFA @switch@/@choose@ statement, where @choose@ performs an implicit @break@ rather than a fall-through at the end of a @case@ clause.
-\begin{cquote}
-\begin{cfa}
+(For this discussion, ignore the fact that @case@ requires a compile-time constant.)
+\begin{cfa}[belowskip=0pt]
 enum Count { First, Second, Third, Fourth };
 Count e;
 \end{cfa}
-\begin{tabular}{ll}
-\begin{cfa}
+\begin{cquote}
+\setlength{\tabcolsep}{15pt}
+\noindent
+\begin{tabular}{@{}ll@{}}
+\begin{cfa}[aboveskip=0pt]
 
 choose( e ) {
@@ -351,5 +306,5 @@
 \end{cfa}
 &
-\begin{cfa}
+\begin{cfa}[aboveskip=0pt]
 // rewrite
 choose( @value@( e ) ) {
@@ -367,88 +322,67 @@
 enum Count { First, Second, Third @= First@, Fourth };
 \end{cfa}
-which make @Third == First@ and @Fourth == Second@, causing a compilation error because of duplicate @case@ clauses.
+making @Third == First@ and @Fourth == Second@, causing a compilation error because of duplicate @case@ clauses.
 To better match with programmer intuition, \CFA toggles between value and position semantics depending on the language context.
 For conditional clauses and switch statements, \CFA uses the robust position implementation.
 \begin{cfa}
-choose( @position@( e ) ) {
-	case @position@( First ): ...;
-	case @position@( Second ): ...;
-	case @position@( Third ): ...;
-	case @position@( Fourth ): ...;
-}
-\end{cfa}
-
-\begin{cfa}
-Count variable_a = First, variable_b = Second, variable_c = Third, variable_d = Fourth;
-p(variable_a); // 0
-p(variable_b); // 1
-p(variable_c); // "Third"
-p(variable_d); // 3
-\end{cfa}
-
-\begin{cfa}
-for (d; Workday) { sout | d; }
-for (p; +~=Planet) { sout | p; }
-for (c: -~=Alphabet ) { sout | c; }
-\end{cfa}
-The @range loop@ for enumeration is a syntax sugar that loops over all enumerators and assigns each enumeration to a variable in every iteration.
-The loop control of the range loop consists of two parts: a variable declaration and a @range expression@, with the type of the variable
-can be inferred from the range expression.
-
-The range expression is an enumeration type, optionally prefixed by @+~=@ or @-~=@. Without a prefix, or prefixed with @+~=@, the control
-loop over all enumerators from the first to the last. With a @-~=@ prefix, the control loops backward.
-
-On a side note, the loop syntax
-\begin{cfa}
-for ( typeof(Workday) d; d <= last(); d = succ(d) );
-\end{cfa}
-does not work. When d == last(), the loop control will still attempt to assign succ(d) to d, which causes an @enumBound@ exception.
-
-\CFA reduces conditionals to its "if case" if the predicate is not equal to ( @!=@ ) zero, and the "else case" otherwise.
-Overloading the @!=@ operator with an enumeration type against the zero defines a conceptual conversion from
-enum to boolean, which can be used as predicates.
-
+if ( @posn@( e ) < posn( Third ) ) ...
+choose( @posn@( e ) ) {
+	case @posn@( First ): ...;
+	case @posn@( Second ): ...;
+	case @posn@( Third ): ...;
+	case @posn@( Fourth ): ...;
+}
+\end{cfa}
+
+\CFA provides a special form of for-control for enumerating through an enumeration, where the range is a type.
+\begin{cfa}
+for ( cx; @Count@ ) { sout | cx | nonl; } sout | nl;
+for ( cx; +~= Count ) { sout | cx | nonl; } sout | nl;
+for ( cx; -~= Count ) { sout | cx | nonl; } sout | nl;
+First Second Third Fourth
+First Second Third Fourth
+Fourth Third Second First
+\end{cfa}
+The enumeration type is syntax sugar for looping over all enumerators and assigning each enumerator to the loop index, whose type is inferred from the range type.
+The prefix @+~=@ or @-~=@ iterate forward or backwards through the inclusive enumeration range, where no prefix defaults to @+~=@.
+
+C has an idiom for @if@ and loop predicates of comparing the predicate result ``not equal to 0''.
+\begin{cfa}
+if ( x + y /* != 0 */ ) ...
+while ( p /* != 0 */ ) ...
+\end{cfa}
+This idiom extends to enumerations because there is a boolean conversion in terms of the enumeration value, if and only if such a conversion is available.
+For example, such a conversion exists for all numerical types (integral and floating-point).
+It is possible to explicitly extend this idiom to any typed enumeration by overloading the @!=@ operator.
+\begin{cfa}
+bool ?!=?( Name n, zero_t ) { return n != Fred; }
+Name n = Mary;
+if ( n ) ... // result is true
+\end{cfa}
+Specialize meanings are also possible.
 \begin{cfa}
 enum(int) ErrorCode { Normal = 0, Slow = 1, Overheat = 1000, OutOfResource = 1001 };
-bool ?!=?(ErrorCode lhs, zero_t) { return value(lhs) >= 1000; }
-ErrorCode code = /.../
-if (code) { scream(); }
-\end{cfa}
-
-Incidentally, \CFA does not define boolean conversion for enumeration. If no 
-@?!=?(ErrorCode, zero_t)@ 
-overloading defined,
-\CFA looks for the boolean conversion in terms of its value and gives a compiler error if no such conversion is available.
-
-\begin{cfa}
-enum(int) Weekday { Mon, Tues, Wed, Thurs, Fri, Sat, Sun, };
-enum() Colour { Red, Green, Blue };
-enum(S) Fruit { Apple, Banana, Cherry }
-Weekday w = ...; Colour c = ...; Fruit f = ...;
-if (w) { ... } // w is true if and only if w != Mon, because value(Mon) == 0 (auto initialized)
-if (c) { ... } // error
-if (s) { ... } // depends on ?!=?(S lhs, zero_t ), and error if no such overloading available
-\end{cfa}
-
-As an alternative, users can define the boolean conversion for CfaEnum:
-
-\begin{cfa}
-forall(E | CfaEnum(E))
-bool ?!=?(E lhs, zero_t) {
-	return posn(lhs) != 0;
-}
-\end{cfa}
-which effectively turns the first enumeration as a logical zero and non-zero for others.
-
-\section{Enumerated Arrays}
-Enumerated arrays use an \CFA array as their index.
-\begin{cfa}
-enum() Colour {
-	Red, Orange, Yellow, Green, Blue, Indigo, Violet
-};
-
-string colourCode[Colour] = { "#e81416", "#ffa500", "#ffa500", "#ffa500", "#487de7", "#4b369d", "#70369d" };
-sout | "Colour Code of Orange is " | colourCode[Orange];
-\end{cfa}
+bool ?!=?( ErrorCode ec, zero_t ) { return ec >= Overheat; }
+ErrorCode code = ...;
+if ( code ) { problem(); }
+\end{cfa}
+
+
+\section{Enumeration Dimension}
+
+\VRef{s:EnumeratorTyping} introduced the harmonizing problem between an enumeration and secondary information.
+When possible, using a typed enumeration for the secondary information is the best approach.
+However, there are times when combining these two types is not possible.
+For example, the secondary information might precede the enumeration and/or its type is needed directly to declare parameters of functions.
+In these cases, having secondary arrays of the enumeration size are necessary.
+
+To support some level of harmonizing in these cases, an array dimension can be defined using an enumerator type, and the enumerators used as subscripts.
+\begin{cfa}
+enum E { A, B, C, N }; // possibly predefined
+float H1[N] = { [A] : 3.4, [B] : 7.1, [C] : 0.01 }; // C
+float H2[@E@] = { [A] : 3.4, [B] : 7.1, [C] : 0.01 }; // CFA
+\end{cfa}
+(Note, C uses the symbol, @'='@ for designator initialization, but \CFA had to change to @':'@ because of problems with tuple syntax.)
+This approach is also necessary for a predefined typed enumeration (unchangeable), when additional secondary-information need to be added.
 
 
@@ -470,5 +404,5 @@
 \small
 \begin{cfa}
-struct MR { double mass, radius; };
+struct MR { double mass, radius; };			$\C{// planet definition}$
 enum( @MR@ ) Planet {						$\C{// typed enumeration}$
 	//                      mass (kg)   radius (km)
