Index: doc/theses/fangren_yu_MMath/content1.tex
===================================================================
--- doc/theses/fangren_yu_MMath/content1.tex	(revision de8a0a4b93508e4ad5a8d0566ef090c279f489b2)
+++ doc/theses/fangren_yu_MMath/content1.tex	(revision a950021625a9c0dd9fa2837bbed60637235f36eb)
@@ -2,5 +2,5 @@
 \label{c:content1}
 
-This chapter discusses \CFA feature introduced over time by multiple people and their interactions with the type system.
+This chapter discusses \CFA features introduced over time by multiple people and their interactions with the type system.
 
 
@@ -19,6 +19,6 @@
 Java has mutable references but no pointers.
 \CC has mutable pointers but immutable references;
-hence, references match with functional programming.
-However, the consequence is asymmetry semantics between the pointer and reference.
+here, references match with functional programming.
+However, the consequence is asymmetric semantics between pointer and reference.
 \CFA adopts a uniform policy between pointers and references where mutability is a separate property made at the declaration.
 
@@ -64,5 +64,5 @@
 The call applies an implicit dereference once to @x@ so the call is typed @f( int & )@ with @T = int@, rather than with @T = int &@.
 
-As for a pointer type, a reference type may have qualifiers, where @const@ is most interesting.
+As for a pointer type, a reference type may have qualifiers, where @const@ is most common.
 \begin{cfa}
 int x = 3; $\C{// mutable}$
@@ -113,4 +113,13 @@
 In the initial \CFA reference design, the goal was to make the reference type a \emph{real} data type \vs a restricted \CC reference, which is mostly used for choosing the argument-passing method, \ie by-value or by-reference.
 However, there is an inherent ambiguity for auto-dereferencing: every argument expression involving a reference variable can potentially mean passing the reference's value or address.
+For example, in
+\begin{cfa}
+int & x;
+forall( T ) void foo( T );
+forall( T ) void bar( T & );
+foo( x ); $\C{// means pass by value}$
+bar( x ); $\C{// means pass by reference}$
+\end{cfa}
+the call to @foo@ must pass @x@ by value, implying auto-dereference, while the call to @bar@ must pass @x@ by reference, implying no auto-dereference.
 Without any restrictions, this ambiguity limits the behaviour of reference types in \CFA polymorphic functions, where a type @T@ can bind to a reference or non-reference type.
 This ambiguity prevents the type system treating reference types the same way as other types, even if type variables could be bound to reference types.
@@ -150,5 +159,5 @@
 Even if the object trait can be made optional, the current type system often misbehaves by adding undesirable auto-dereference on the referenced-to value rather than the reference variable itself, as intended.
 Some tweaks are necessary to accommodate reference types in polymorphic contexts and it is unclear what can or cannot be achieved.
-Currently, there are contexts where \CFA programmer is forced to use a pointer type, giving up the benefits of auto-dereference operations and better syntax with reference types.
+Currently, there are contexts where the \CFA programmer is forced to use a pointer type, giving up the benefits of auto-dereference operations and better syntax with reference types.
 
 
@@ -162,22 +171,20 @@
 \begin{tabular}{@{}l@{\hspace{20pt}}l@{}}
 \begin{cfa}
-
-int foo( int &p2, int &p3 );  // in/out parameters
+int foo( int &p1, int &p2 );  // in/out parameters
 int x, y = 3, z = 4;
-x = foo( y, z );  // return 3 values
+x = foo( y, z );  // return 3 values: 1 out, 2 in/out
 \end{cfa}
 &
 \begin{cfa}
-struct Ret { int x, y, z; };
-Ret foo( int p2, int p3 );  // multiple return values
-Ret ret = { .y = 3, .z = 4 };
-ret = foo( ret.y, ret.z );  // return 3 values
+struct Ret { int x, y, z; } ret;
+Ret foo( int p1, int p2 );  // return structure
+ret = foo( 3, 4 );  // return 3 values: 3 out
 \end{cfa}
 \end{tabular}
 \end{cquote}
-K-W C allows direct return of multiple values into a tuple.
-\begin{cfa}
-@[int, int, int]@ foo( int p2, int p3 );
-@[x, y, z]@ = foo( y, z );  // return 3 values into a tuple
+Like Go, K-W C allows direct return of multiple values into a tuple.
+\begin{cfa}
+@[int, int, int]@ foo( int p1, int p2 );
+@[x, y, z]@ = foo( 3, 4 );  // return 3 values into a tuple
 \end{cfa}
 Along with making returning multiple values a first-class feature, tuples were extended to simplify a number of other common context that normally require multiple statements and/or additional declarations, all of which reduces coding time and errors.
@@ -205,9 +212,16 @@
 bar( @foo@( 3 ), @foo@( 3 ) );
 \end{cfa}
-The type resolver only has the tuple return types to resolve the call to @bar@ as the @foo@ parameters are identical, which involves unifying the flattened @foo@ return values with @bar@'s parameter list.
+The type resolver only has the tuple return types to resolve the call to @bar@ as the @foo@ parameters are identical.
+The resultion involves unifying the flattened @foo@ return values with @bar@'s parameter list.
 However, no combination of @foo@s is an exact match with @bar@'s parameters;
 thus, the resolver applies C conversions to obtain a best match.
 The resulting minimal cost expression is @bar( foo@$_1$@( 3 ), foo@$_2$@( 3 ) )@, where the two possible coversions are (@int@, {\color{red}@int@}, @double@) to (@int@, {\color{red}@double@}, @double@) with a safe (widening) conversion from @int@ to @double@ versus ({\color{red}@double@}, {\color{red}@int@}, {\color{red}@int@}) to ({\color{red}@int@}, {\color{red}@double@}, {\color{red}@double@}) with one unsafe (narrowing) conversion from @double@ to @int@ and two safe conversions from @int@ to @double@.
-The programming language Go provides a similar but simplier tuple mechanism, as it does not have overloaded functions.
+Go provides a simplified mechanism where only one tuple returning function call is allowed and there are no implicit type conversions.
+\begin{lstlisting}[language=Go]
+func foo( int ) ( int, int, int ) { return 3, 7, 8 }
+func bar( int, int, int ) { ... } // types must match
+bar( foo( 3 ) ) // only one tuple returning call 
+\end{lstlisting}
+Hence, programers cannot take advantage of the full power of tuples but type match is straightforward.
 
 K-W C also supported tuple variables, but with a strong distinction between tuples and tuple values/variables.
@@ -305,7 +319,7 @@
 \end{cfa}
 \VRef[Figure]{f:AlternateTupleImplementation} shows the two implementation approaches.
-In the left approach, the return statement is rewritten to pack the return values into a structure, which is returned by value, and the structure fields are indiviually assigned to the left-hand side of the assignment.
+In the left approach, the return statement is rewritten to pack the return values into a structure, which is returned by value, and the structure fields are individually assigned to the left-hand side of the assignment.
 In the right approach, the return statement is rewritten as direct assignments into the passed-in argument addresses.
-The right imlementation looks more concise and saves unnecessary copying.
+The upside of the right implementation is consistence and no copying.
 The downside is indirection within @gives_two@ to access values, unless values get hoisted into registers for some period of time, which is common.
 
@@ -314,5 +328,5 @@
 \setlength{\tabcolsep}{20pt}
 \begin{tabular}{@{}ll@{}}
-Till K-W C implementation & Rodolfo \CFA implementation \\
+Till K-W C implementation & Esteves \CFA implementation \\
 \begin{cfa}
 struct _tuple2 { int _0; int _1; }
@@ -343,7 +357,30 @@
 
 Interestingly, in the third implementation of \CFA tuples by Robert Schluntz~\cite[\S~3]{Schluntz17}, the MVR functions revert back to structure based, where it remains in the current version of \CFA.
-The reason for the reversion was to have a uniform approach for tuple values/variables making tuples first-class types in \CFA, \ie allow tuples with corresponding tuple variables.
-This extension was possible, because in parallel with Schluntz's work, generic types were added independently by Moss~\cite{Moss19}, and the tuple variables leveraged the same implementation techniques as the generic variables.
-\PAB{I'm not sure about the connection here. Do you have an example of what you mean?}
+The reason for the reversion is a uniform approach for tuple values/variables making tuples first-class types in \CFA, \ie allow tuples with corresponding tuple variables.
+This reversion was possible, because in parallel with Schluntz's work, generic types were added independently by Moss~\cite{Moss19}, and the tuple variables leveraged the same implementation techniques as for generic variables~\cite[\S~3.7]{Schluntz17}.
+For example, these two tuples:
+\begin{cfa}
+[double, double] x;
+[int, double, int] y;
+\end{cfa}
+are transformed internally into two generic structures:
+\begin{cfa}
+forall( T0 &, & T1 | sized( T0 ) | sized( T1 ) )
+struct _tuple2_ {
+	T0 field_0 ;   T1 field_1 ;
+};
+forall( T0 &, T1 &, T2 & | sized( T0 ) | sized( T1 ) | sized( T2 ) )
+struct _tuple3_ {
+	T0 field_0 ;   T1 field_1 ;   T2 field_2 ;
+};
+\end{cfa}
+and the declarations become instances of these generic structure types:
+\begin{cfa}
+_tuple2_( double, double ) x;
+_tuple3_( int, double, int ) y;
+\end{cfa}
+Now types @_tuple2_@ and @_tuple3_@ are available for any further 2 or 3 tuple-types in the translation unit, simplifying internal code transformations by memoizing a small set of tuple structures.
+Ultimately, these generic types are lowered to specific C structures during code generation.
+Scala, like \CC, provides tuple types through a library using this structural expansion, \eg Scala provides tuple sizes 1 through 22 via hand-coded generic data-structures.
 
 However, after experience gained building the \CFA runtime system, making tuple-types first-class seems to add little benefit.
@@ -361,5 +398,5 @@
 Furthermore, since operator overloading in \CFA is implemented by treating operators as overloadable functions, tuple types are very rarely used in a structured way.
 When a tuple-type expression appears in a function call (except assignment expressions, which are handled differently by mass- or multiple-assignment expansions), it is always flattened, and the tuple structure of function parameter is not considered a part of the function signatures.
-For example,
+For example, these two prototypes for @foo@:
 \begin{cfa}
 void f( int, int );
@@ -367,5 +404,5 @@
 f( 3, 4 );  // ambiguous call
 \end{cfa}
-the two prototypes for @foo@ have the same signature (a function taking two @int@s and returning nothing), and therefore invalid overloads.
+have the same signature (a function taking two @int@s and returning nothing), and therefore invalid overloads.
 Note, the ambiguity error occurs at the call rather than at the second declaration of @f@, because it is possible to have multiple equivalent prototype definitions of a function.
 Furthermore, ordinary polymorphic type-parameters are not allowed to have tuple types.
@@ -385,6 +422,90 @@
 Therefore, tuple types are never present in any fixed-argument function calls, because of the flattening.
 
+\begin{comment}
+Date: Mon, 13 Jan 2025 10:09:06 -0500
+Subject: Re: structure / tuple
+To: "Peter A. Buhr" <pabuhr@uwaterloo.ca>
+CC: Andrew Beach <ajbeach@uwaterloo.ca>,
+        Michael Brooks <mlbrooks@uwaterloo.ca>,
+        Fangren Yu <f37yu@uwaterloo.ca>, Jiada Liang <j82liang@uwaterloo.ca>,
+        Alvin Zhang <alvin.zhang@uwaterloo.ca>,
+        Kyoung Seo <lseo@plg.uwaterloo.ca>
+From: Gregor Richards <gregor.richards@uwaterloo.ca>
+
+Languages support tuples to abbreviate syntax where the meaning of several
+values is obvious from context, such as returns from functions, or where the
+effort of creating a dedicated type is not worth the reward of using that type
+in exactly one location. The positions always have meanings which could be
+given names, and are only not given names for brevity. Whether that brevity is
+a good idea or not is the programmer's problem to deal with. I don't think
+there's any pragmatic value to tuples beyond brevity. (From a theoretical
+perspective, having the empty tuple is useful for type-theoretical reasons, and
+tuples are usually easier to reason about than structures, but that only
+applies to theoretical reasoning, not to actual programming.)
+
+Your distinction unstructured tuples could just as well be made for structs as
+well, if you had named arguments (or named returns?).  Personally, I think that
+having these be a syntactic distinction is a mistake. Other languages return
+fully codified tuples, and if you immediately destructure them, even the most
+naive optimizer will manage to never create an actual tuple in memory. In my
+opinion, since tuples are for brevity, they should always be declared with your
+"unstructured" syntax, and it's up to the optimizer to realize when you've
+never stored them. But, you live closer to the metal in CFA than most
+languages, so perhaps communicating that intent is of sufficient value.
+
+The only value of tuples beyond that is to make it possible for annoying
+students to use std::pair in place of ever creating their own class hierarchy
+or naming things. Then again, I hear that that is one of the hard problems in
+computer science.
+
+With valediction,
+  - Gregor Richards
+
+On 1/13/25 09:11, Peter A. Buhr wrote:
+> The CFA team has been discussing the difference between a structure and
+> tuple.  Basically, a structure has named fields and a tuple has anonymous
+> fields. As a result, structure access uses field names and tuple access uses
+> position.
+>
+>    struct S { int i, j, k ; };
+>    S s;
+>    s.i; s.j; // field access
+>
+>    tuple T { int, int };
+>    T t;
+>    t.0; t.1; // position access, zero origin
+>    t[0]; t[1]; // alternate access
+>
+> Hence the difference is small.
+>
+> In CFA, we differentiate between unstructured and structured tuples. An
+> unstructured tuple is a lexical grouping of potentially disjoint variables.
+>
+>    [ int, int, int ] f();
+>    void g( int, int, int );
+>    x, y, z = f(); // Go unstructured tuple, flatten tuple
+>    g( foo() ); // flatten tuple
+>
+> Here, the tuple returned from f is flattened into disjoint variables.  A
+> structured tuple is like above and has contiguous memory.
+>
+> CFA has fancy unstructured stuff like
+>
+>    s.[i,k] += 1; // add 1 to each field
+>    t.[1,0] = 1; // don't think this works but could
+>
+> which is just an unstructured tuple access (sugar).
+>
+> What is your opinion of structures and tuples since the difference is
+> small. Why do many languages support both features? Are we missing some
+> important aspect of tuples that differentiates them from structures?  Is CFA
+> unique in having both unstructured and structured tuples?
+\end{comment}
+
 Finally, a type-safe variadic argument signature was added by Robert Schluntz~\cite[\S~4.1.2]{Schluntz17} using @forall@ and a new tuple parameter-type, denoted by the keyword @ttype@ in Schluntz's implementation, but changed to the ellipsis syntax similar to \CC's template parameter pack.
 For C variadics, \eg @va_list@, the number and types of the arguments must be conveyed in some way, \eg @printf@ uses a format string indicating the number and types of the arguments.
+\begin{cfa}
+int printf( const char * format, ${\color{red}\LARGE ...}$ );  // variadic list of variables to print
+\end{cfa}
 \VRef[Figure]{f:CVariadicMaxFunction} shows an $N$ argument @maxd@ function using the C untyped @va_list@ interface.
 In the example, the first argument is the number of following arguments, and the following arguments are assumed to be @double@;
@@ -396,13 +517,13 @@
 \begin{cfa}
 double maxd( int @count@, @...@ ) { // ellipse parameter
-    double max = 0;
-    va_list args;
-    va_start( args, count );
-    for ( int i = 0; i < count; i += 1 ) {
-        double num = va_arg( args, double );
-        if ( num > max ) max = num;
-    }
-    va_end(args);
-    return max;
+	double max = 0;
+	va_list args;
+	va_start( args, count );
+	for ( int i = 0; i < count; i += 1 ) {
+		double num = va_arg( args, double );
+		if ( num > max ) max = num;
+	}
+	va_end(args);
+	return max;
 }
 printf( "%g\n", maxd( @4@, 25.0, 27.3, 26.9, 25.7 ) );
@@ -412,5 +533,5 @@
 \end{figure}
 
-There are two common patterns for using the variadic functions in \CFA.
+There are two common patterns for using variadic functions in \CFA.
 \begin{enumerate}[leftmargin=*]
 \item
@@ -430,12 +551,12 @@
 Structural recursion for processing the argument-pack values one at a time, \eg:
 \begin{cfa}
-forall( T | { int ?>?( T, T ); } )
-T max( T v1, T v2 ) { return v1 > v2 ? v1 : v2; }
+forall( T | { int ?<?( T, T ); } )
+T max( T v1, T v2 ) { return v1 < v2 ? v2 : v1; }
 $\vspace{-10pt}$
 forall( T, TT ... | { T max( T, T ); T max( TT ); } )
 T max( T arg, TT args ) { return max( arg, max( args ) ); }
 \end{cfa}
-The first non-recursive @max@ function is the polymorphic base-case for the recursion, \ie, find the maximum of two identically typed values with a greater-than (@>@) operator.
-The second recursive @max@ function takes two parameters, a @T@ and a @TT@ tuple pack, handling all argument lengths greater than two.
+The first non-recursive @max@ function is the polymorphic base-case for the recursion, \ie, find the maximum of two identically typed values with a less-than (@<@) operator.
+The second recursive @max@ function takes two parameters, @T@ and the @TT@ tuple pack, handling all argument lengths greater than two.
 The recursive function computes the maximum for the first argument and the maximum value of the rest of the tuple pack.
 The call of @max@ with one argument is the recursive call, where the tuple pack is converted into two arguments by taking the first value (lisp @car@) from the tuple pack as the first argument (flattening) and the remaining pack becomes the second argument (lisp @cdr@).
@@ -452,11 +573,11 @@
 And because \CFA compiles polymorphic functions versus template expansion, many wrapper functions are generated to implement both user-defined generic-types and polymorphism with variadics.
 Fortunately, the only permitted operations on polymorphic function parameters are given by the list of assertion (trait) functions.
-Nevertheless, this small set of functions eventually need to be called with flattened tuple arguments.
+Nevertheless, this small set of functions eventually needs to be called with flattened tuple arguments.
 Unfortunately, packing the variadic arguments into a rigid @struct@ type and generating all the required wrapper functions is significant work and largely wasted because most are never called.
 Interested readers can refer to pages 77-80 of Robert Schluntz's thesis to see how verbose the translator output is to implement a simple variadic call with 3 arguments.
 As the number of arguments increases, \eg a call with 5 arguments, the translator generates a concrete @struct@ types for a 4-tuple and a 3-tuple along with all the polymorphic type data for them.
 An alternative approach is to put the variadic arguments into an array, along with an offset array to retrieve each individual argument.
-This method is similar to how the C @va_list@ object is used (and how \CFA accesses polymorphic fields in a generic type), but the \CFA variadics generate the required type information to guarantee type safety.
-For example, given the following heterogeneous, variadic, typed @print@ and usage.
+This method is similar to how the C @va_list@ object is used (and how \CFA accesses polymorphic fields in a generic type), but the \CFA variadics generate the required type information to guarantee type safety (like the @printf@ format string).
+For example, given the following heterogeneous, variadic, typed @print@ and usage:
 \begin{cquote}
 \begin{tabular}{@{}ll@{}}
@@ -487,13 +608,13 @@
 }
 \end{cfa}
-where the fixed-arg polymorphism for @T@ can be handled by the standard @void *@-based \CFA polymorphic calling conventions, and the type information can all be deduced at the call site.
+where the fixed-arg polymorphism for @T@ can be handled by the standard @void *@-based \CFA polymorphic calling conventions, and the type information can be deduced at the call site.
 Note, the variadic @print@ supports heterogeneous types because the polymorphic @T@ is not returned (unlike variadic @max@), so there is no cascade of type relationships.
 
 Turning tuples into first-class values in \CFA does have a few benefits, namely allowing pointers to tuples and arrays of tuples to exist.
-However, it seems unlikely that these types have realistic use cases that cannot be achieved without them.
+However, it seems unlikely that these types have realistic use cases that cannot be achieved with structures.
 And having a pointer-to-tuple type potentially forbids the simple offset-array implementation of variadic polymorphism.
 For example, in the case where a type assertion requests the pointer type @TT *@ in the above example, it forces the tuple type to be a @struct@, and thus incurring a high cost.
 My conclusion is that tuples should not be structured (first-class), rather they should be unstructured.
-This agrees with Rodolfo's original describes
+This agrees with Rodolfo's original description:
 \begin{quote}
 As such, their [tuples] use does not enforce a particular memory layout, and in particular, does not guarantee that the components of a tuple occupy a contiguous region of memory.~\cite[pp.~74--75]{Esteves04}
@@ -509,5 +630,5 @@
 However, this forces the programer to use a tuple variable and possibly a tuple type to support a constructor, when they actually want separate variables with separate constructors.
 And as stated previously, type variables (structured tuples) are rare in general \CFA programming so far.
-To address this issue, while retaining the ability to leverage constructors, the following new tuple-like declaration syntax is proposed.
+To address this issue, while retaining the ability to leverage constructors, I proposed the following new tuple-like declaration syntax.
 \begin{cfa}
 [ int x, int y ] = gives_two();
@@ -521,4 +642,5 @@
 \end{cfa}
 and the implementation performs as much copy elision as possible.
+Currently, this new declaration form is parsed by \CFA, showing its syntax is viable, but it is unimplemented because of downstream resolver issues.
 
 
@@ -526,16 +648,17 @@
 \label{s:inlineSubstructure}
 
-As mentioned \see{\VRef[Figure]{f:Nesting}}, C allows an anonymous aggregate type (@struct@ or @union@) to be embedded (nested) within another one, \eg a tagged union.
+As mentioned, C allows an anonymous aggregate type (@struct@ or @union@) to be embedded (nested) within another one \see{\VRef[Figure]{f:Nesting}}, \eg a tagged union.
 \begin{cfa}
 struct S {
 	unsigned int tag;
-	union { $\C{// anonymous nested aggregate}$
+	union { // anonymous nested aggregate
 		int x;  double y;  char z;
 	};
 } s;
 \end{cfa}
-The @union@ field-names are hoisted into the @struct@, so there is direct access, \eg @s.x@;
-hence, field names must be unique.
-For a nested anonymous @struct@, both field names and values are hoisted.
+Here, the @union@ combines its field into a common block of storage, and because there is no variable-name overloading in C, all of the union field names must be unique.
+Furthermore, because the union is unnamed, these field-names are hoisted into the @struct@, giving direct access, \eg @s.x@;
+hence, the union field names must be unique with the structure field names.
+The same semantics applies to a nested anonymous @struct@:
 \begin{cquote}
 \begin{tabular}{@{}l@{\hspace{35pt}}l@{}}
@@ -556,7 +679,24 @@
 \end{tabular}
 \end{cquote}
-
-As an aside, C nested \emph{named} aggregates behave in a (mysterious) way because the nesting is allowed but there is no ability to use qualification to access an inner type, like the \CC type operator `@::@'.
-\emph{In fact, all named nested aggregates are hoisted to global scope, regardless of the nesting depth.}
+However, unlike the union which provides storage sharing, there is no semantic difference between the nested anonymous structure and its rewritten counterpart.
+Hence, the nested anonymous structure provides no useful capability.
+
+Nested \emph{named} aggregates are allowed in C but there is no qualification operator, like the \CC type operator `@::@', to access an inner type.
+\emph{To compensate for the missing type operator, all named nested aggregates are hoisted to global scope, regardless of the nesting depth, and type usages within the nested type are replaced with global type name.}
+Hoisting nested types can result in name collisions among types at the global level, which defeats the purpose of nesting the type.
+\VRef[Figure]{f:NestedNamedAggregate} shows the nested type @T@ is hoisted to the global scope and the declaration rewrites within structure @S@.
+Hence, the possible accesses are:
+\begin{cfa}
+struct S s;
+s.i = 1;
+s.t.i = 2;
+s.w = (struct T){ 7, 8 };
+struct T x = { 5, 6 }; // use (un)nested type name
+s.t = (struct T){ 2, 3 };
+\end{cfa}
+where @T@ is used without qualification even though it is nested in @S@.
+It is for these reasons that nested types are not used in C, and if used, are extremely confusing.
+
+\begin{figure}
 \begin{cquote}
 \begin{tabular}{@{}l@{\hspace{35pt}}l@{}}
@@ -564,32 +704,29 @@
 \begin{cfa}
 struct S {
-	struct T {
+	@struct T@ {
 		int i, j;
-	};
-	struct U {
-		int k, l;
-	};
-};
+	} t; // warning without declaration
+	struct T w;
+	int k;
+};
+
 \end{cfa}
 &
 \begin{cfa}
-struct T {
+@struct T@ {
 	int i, j;
 };
-struct U {
-	int k, l;
-};
 struct S {
+	@struct T t@;
+	struct T w;
+	int k;
 };
 \end{cfa}
 \end{tabular}
 \end{cquote}
-Hence, the possible accesses are:
-\begin{cfa}
-struct S s; // s cannot access any fields
-struct T t;  t.i;  t.j;
-struct U u;  u.k;  u.l;
-\end{cfa}
-and the hoisted type names can clash with global type names.
+\caption{Nested Named Aggregate}
+\label{f:NestedNamedAggregate}
+\end{figure}
+
 For good reasons, \CC chose to change this semantics:
 \begin{cquote}
@@ -604,19 +741,16 @@
 \hfill ISO/IEC 14882:1998 (\CC Programming Language Standard)~\cite[C.1.2.3.3]{ANSI98:C++}
 \end{cquote}
-However, there is no syntax to access from a variable through a type to a field.
-\begin{cfa}
-struct S s;  @s::T@.i;  @s::U@.k;
-\end{cfa}
 \CFA chose to adopt the \CC non-compatible change for nested types, since \CC's change has already forced certain coding changes in C libraries that must be parsed by \CC.
 \CFA also added the ability to access from a variable through a type to a field.
 \begin{cfa}
-struct S s;  @s.T@.i;  @s.U@.k;
-\end{cfa}
+struct S s;  @s.i@;  @s.T@.i;
+\end{cfa}
+See the use case for this feature at the end of this section.
 
 % https://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html
 
-A polymorphic extension to nested aggregates appears in the Plan-9 C dialect, used in the Bell Labs' Plan-9 research operating system.
+A polymorphic extension to nested aggregates appears in the Plan-9 C dialect, used in the Bell Labs' Plan-9 research operating-system.
 The feature is called \newterm{unnamed substructures}~\cite[\S~3.3]{Thompson90new}, which continues to be supported by @gcc@ and @clang@ using the extension (@-fplan9-extensions@).
-The goal is to provided the same effect of the nested aggregate with the aggregate type defined elsewhere, which requires it be named.
+The goal is to provided the same effect as a nested aggregate with the aggregate type defined elsewhere, which requires it be named.
 \begin{cfa}
 union U {  $\C{// unnested named}$
@@ -633,5 +767,5 @@
 \end{cfa}
 Note, the position of the substructure is normally unimportant, unless there is some form of memory or @union@ overlay.
-Like an anonymous nested type, a named nested Plan-9 type has its field names hoisted into @struct S@, so there is direct access, \eg @s.x@ and @s.i@.
+Like an anonymous nested type, a named Plan-9 nested type has its field names hoisted into @struct S@, so there is direct access, \eg @s.x@ and @s.i@.
 Hence, the field names must be unique, unlike \CC nested types, but the type names are at a nested scope level, unlike type nesting in C.
 In addition, a pointer to a structure is automatically converted to a pointer to an anonymous field for assignments and function calls, providing containment inheritance with implicit subtyping, \ie @U@ $\subset$ @S@ and @W@ $\subset$ @S@, \eg:
@@ -689,5 +823,5 @@
 However, the Plan-9 semantics allow implicit conversions from the outer type to the inner type, which means the \CFA type resolver must take this information into account.
 Therefore, the \CFA resolver must implement the Plan-9 features and insert necessary type conversions into the translated code output.
-In the current version of \CFA, this is the only kind of implicit type conversion other than the standard C conversions.
+In the current version of \CFA, this is the only kind of implicit type conversion other than the standard C arithmetic conversions.
 
 Plan-9 polymorphism can result in duplicate field names.
@@ -714,5 +848,5 @@
 and again the expression @d.x@ is ambiguous.
 While \CC has no direct syntax to disambiguate @x@, \ie @d.B.x@ or @d.C.x@, it is possible with casts, @((B)d).x@ or @((C)d).x@.
-Like \CC, \CFA compiles the Plan-9 version and provides direct syntax and casts to disambiguate @x@.
+Like \CC, \CFA compiles the Plan-9 version and provides direct qualification and casts to disambiguate @x@.
 While ambiguous definitions are allowed, duplicate field names is poor practice and should be avoided if possible.
-However, when a programmer does not control all code, this problem can occur and a naming workaround should exist.
+However, when a programmer does not control all code, this problem can occur and a naming workaround must exist.
