Changeset f3abce9


Ignore:
Timestamp:
Aug 7, 2024, 12:53:27 AM (4 hours ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
1d8a349
Parents:
59fb462
Message:

update subset section

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/jiada_liang_MMath/CFAenum.tex

    r59fb462 rf3abce9  
    204204enum( char ) Letter { A = 'A', ... };
    205205enum( @Letter@ ) Greek { Alph = A, Beta = B, ... }; // alphabet intersection
    206 \end{cfa}
    207 Enumeration @Greek@ may have more or less enums than @Letter@, but the enum values \emph{must} be from @Letter@.
    208 Therefore, @Greek@ enums are a subset of type @Letter@ and are type compatible with enumeration @Letter@, but @Letter@ enums are not type compatible with enumeration @Greek@.
    209 
     206
     207void foo(Letter l);
     208foo(Beta);                      $\C{// foo(value(Beta))}$
     209\end{cfa}
     210Enumeration @Greek@ may have more or less enumerators than @Letter@, but the enum values \emph{must} be of a member of @Letter@.
     211Therefore, the set of @Greek@ enum value in a subset of the value set of type @Letter@.
     212@Letter@ is type compatible with enumeration @Letter@ thanks to \CFA inserts value conversion whenever @Letter@ be used
     213in place of @Greek@. On the other hand, @Letter@ enums are not type compatible with enumeration @Greek@.
     214As a result, @Greek@ becomes a logical subtype of @Letter@.
     215
     216Subset defines an implicit subtyping relationship between two \CFA enumerations. \CFA also has
     217containment inheritance for \CFA enumerations to explicit structure subtyping.
    210218
    211219\section{Inheritance}
     
    238246enum() E1 { B };                                                                $\C{// B}$                                             
    239247enum() E2 { C, D };                                                             $\C{// C D}$
    240 enum() E3 { inline E1, inline E2, E };                  $\C{// {\color{red}[\(_{E1}\)} B {\color{red}]} {\color{red}[\(_{E2}\)} C, D {\color{red}]} E}$
    241 enum() E4 { A, inline E3, F};                                   $\C{// A {\color{blue}[\(_{E3}\)} {\color{red}[\(_{E1}\)} B {\color{red}]} {\color{red}[\(_{E2}\)} C, D {\color{red}]} E {\color{blue}]} F }$
     248enum() E3 { inline E1, inline E2, E };                  $\C{// {\color{red}[\(_{E1}\)} B {\color{red}]} {\color{red}[\(_{E2}\)} C D {\color{red}]} E}$
     249enum() E4 { A, inline E3, F};                                   $\C{// A {\color{blue}[\(_{E3}\)} {\color{red}[\(_{E1}\)} B {\color{red}]} {\color{red}[\(_{E2}\)} C D {\color{red}]} E {\color{blue}]} F }$
    242250\end{cfa}
    243251In the example above, @B@ has the position 0 in @E1@ and @E3@, but it at the position 1 in @E4@ as @A@ taking the 0 in @E4@.
Note: See TracChangeset for help on using the changeset viewer.