- Timestamp:
- Aug 8, 2024, 3:21:04 PM (4 months ago)
- Branches:
- master
- Children:
- ab11ab1
- Parents:
- a8f44c8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/jiada_liang_MMath/relatedwork.tex
ra8f44c8 r5b4c8df 33 33 The type of each constant name (enumerator) is inferred from the constant-expression type. 34 34 35 Pascal introduced the enumeration type characterized by a set of ordered, unscoped identifiers (enumerators), which are not overloadable.\footnote{%35 Some dialects of Pascal introduced the enumeration type characterized by a set of ordered, unscoped identifiers (enumerators), which are not overloadable.\footnote{% 36 36 Pascal is \emph{case-insensitive} so identifiers may appear in multiple forms and still be the same, \eg \lstinline{Mon}, \lstinline{moN}, and \lstinline{MON} (a questionable design decision).} 37 37 \begin{pascal} … … 1246 1246 & 1247 1247 \begin{ocaml} 1248 1249 1250 1251 1252 1248 1253 3 1249 1254 3.5 1250 1255 3 5 1251 1252 1253 1254 1255 1256 1256 \end{ocaml} 1257 1257 \end{tabular} … … 1532 1532 \section{Comparison} 1533 1533 1534 \VRef[Table]{t:FeatureLanguageComparison} shows a comparison of enumeration features and programming languages. 1535 The features are high level and may not capture nuances within a particular language 1536 The @const@ feature is simple macros substitution and not a typed enumeration. 1534 \VRef[Table]{t:FeatureLanguageComparison} shows a comparison of enumeration features and programming languages with the explaination of categories below. 1535 The features are high level and may not capture nuances within a particular language. 1537 1536 1538 1537 \begin{table} … … 1543 1542 \newcommand{\CM}{\checkmark} 1544 1543 \begin{tabular}{r|c|c|c|c|c|c|c|c|c|c|c|c|c} 1545 &Pascal & Ada &\Csharp & OCaml & Java &Golang& Rust & Swift & Python& C & \CC & \CFA \\1544 &Pascal & Ada &\Csharp & OCaml & Java &Golang & Rust & Swift & Python& C & \CC & \CFA \\ 1546 1545 \hline 1547 enum &Dialect& \CM & \CM & ADT & \CM & @const@&ADT/\CM&ADT/\CM & \CM &\CM &\CM &\CM\\1546 enum &Dialect& \CM & \CM & ADT & \CM & @const@ &ADT/\CM &ADT/\CM & \CM &\CM &\CM &\CM\\ 1548 1547 \hline 1549 1548 \hline 1550 opaque & & & & \CM & \CM & && \CM & & & & \CM \\1549 opaque & \CM & & & \CM & \CM & & \CM & \CM & & & & \CM \\ 1551 1550 \hline 1552 typed & Int & Int & Integral & H & U & H & U/H& U/H & H & Int & Integral& U \\1551 typed & Int & Int & Integral & H & U & H & U/H & U/H & H & Int & Integral& U \\ 1553 1552 \hline 1554 safety & \CM & \CM & & \CM & \CM & & \CM & \CM & & & \CM & \CM \\1553 safety & \CM & \CM & & \CM & \CM & & \CM & \CM & & & \CM & \CM \\ 1555 1554 \hline 1556 posn ordered & \CM & \CM & \CM & \CM & \CM & & & \CM& & & & \CM \\1555 posn ordered & Implied & Implied & & \CM & & & & & & & & \CM \\ 1557 1556 \hline 1558 unique values & \CM & & \CM & & \CM & \CM & & \CM & alias & \CM & \CM & \CM\\1557 unique values & \CM & \CM & & & & & & \CM & & & & \\ 1559 1558 \hline 1560 % setable repr. & \CM & \CM & \CM & & \CM & \CM & \CM & \CM & \CM & \CM & \CM & \CM \\ 1561 % \hline 1562 auto-init & \CM & @all or none@ & \CM & & & \CM & \CM & \CM & \CM & \CM & \CM & \CM \\ 1563 % This one is tricky: C/C++/CC has auto-init value. Some have auto-init underlying representation 1559 auto-init & \CM & @all or none@ & \CM & & & \CM & \CM & \CM & \CM & \CM & \CM & \CM \\ 1564 1560 \hline 1565 ( Un)Scoped & U & U & S & S & S & U & S& S & S & U & U/S & U/S \\1561 (un)Scoped & U & U & S & S & S & U & S & S & S & U & U/S & U/S \\ 1566 1562 \hline 1567 overload & & \CM & n/a & n/a &n/a & & n/a & n/a &n/a& & & \CM \\1563 overload & & \CM & & & & & & & & & & \CM \\ 1568 1564 \hline 1569 loop & \CM & \CM & & & & && & \CM & & & \CM \\1565 loop & \CM & \CM & & & & & & & \CM & & & \CM \\ 1570 1566 \hline 1571 % array/subscript & & & & & & & & & & \CM & & \CM \\ 1572 % \hline 1573 subset & \CM & \CM & & \CM & & & & & & & & \CM \\ 1567 arr. dim. & \CM & \CM & & & & & & & & & & \CM \\ 1574 1568 \hline 1575 superset & & & & & & & & & & & & \CM \\ 1569 subset & \CM & \CM & & \CM & & & & & & & & \CM \\ 1570 \hline 1571 superset & & & & & & & & & & & & \CM \\ 1576 1572 \end{tabular} 1577 1573 \end{table} 1578 1574 1579 1575 \begin{enumerate} 1580 \item Opaque: Language has opaque enum if its enumerator cannot be used as its underlying representation or its enum is implemented asADT.1581 \item Typed: The type of value. H: heterogeneous type; enumerators from the same enum need not be hasthe same type.1582 U: uni-type; enumeratorsmust have the same type.1576 \item Opaque: Opaque enums' enumerator cannot be used as its underlying representation or being implemented in terms of ADT. 1577 \item Typed: The type of value. H: heterogeneous type; values from the same enum need not be the same type. 1578 U: uni-type; value must have the same type. 1583 1579 \item Safe: A enumeration variable can only hold a value from its defined enumerators. 1584 1580 \item Posn ordered: enumerators have defined ordering based on enuemrator declaration order. 1581 It is implied position ordered if its enumerator value must be strictly increasingly ordered. 1585 1582 \item Unique value: enumerators must have unique value. 1586 \item Auto-init: Value are auto initializable. 1587 \item (Un)Scoped: U: unscoped enuemrators and does not need qualification; S: Scoped enumerators and requires qualification 1588 \item Overload: An enumerator label can be used without type qualification in a context where the label has defined by multiple enumerations 1589 \item Loop: Enumerate enum members without explicitly convert it to other data structures 1590 \item Subset: Name a subset of enumerator as a new type. 1591 \item Superset: Create a new enumeration that contain all enumerators from pre-defined enuemration. 1583 \item Auto-init: Value are auto initializable by language specification, often being the "+1" of the predecessor. 1584 \item (Un)Scoped: U: unscoped enuemrators and does not need qualification; S: Scoped enumerators and requires qualification. 1585 \item Overload: An enumerator label can be used without type qualification in a context where the label has defined by multiple enumerations. 1586 \item Loop: Enumerate enum members without the need to convert an enumeration to another data structure 1587 \item Arr. dim: An enumeration can be used directly as array dimension and enumerators can be mapped to an array element (not a conversion to integer type). 1588 \item Subset: Name a subset of enumerators as a new type. 1589 \item Superset: Create a new enumeration that contains all enumerators from pre-defined enuemrations. 1592 1590 \end{enumerate}
Note: See TracChangeset
for help on using the changeset viewer.