Changeset b0069a3 for doc/theses
- Timestamp:
- Aug 7, 2024, 7:07:30 PM (3 months ago)
- Branches:
- master
- Children:
- a8f44c8
- Parents:
- 92a0ee8 (diff), 9d3a4cc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- doc/theses/jiada_liang_MMath
- Files:
-
- 3 deleted
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/jiada_liang_MMath/CFAenum.tex
r92a0ee8 rb0069a3 1 \chapter{\ CFAEnumeration}1 \chapter{\texorpdfstring{\CFA}{Cforall} Enumeration} 2 2 3 3 \CFA extends C-Style enumeration by adding a number of new features that bring enumerations inline with other modern programming languages. … … 59 59 The label and value of an enumerator is stored in a global data structure for each enumeration, where attribute functions @label@/@value@ map an \CFA enumeration object to the corresponding data. 60 60 These operations do not apply to C Enums because backwards compatibility means the necessary backing data structures cannot be supplied. 61 61 62 62 63 \section{Opaque Enumeration} -
doc/theses/jiada_liang_MMath/Cenum.tex
r92a0ee8 rb0069a3 1 \chapter{C Enumeration in \ CFA}1 \chapter{C Enumeration in \texorpdfstring{\CFA}{Cforall}} 2 2 3 3 \CFA supports legacy C enumeration using the same syntax for backwards compatibility. -
doc/theses/jiada_liang_MMath/background.tex
r92a0ee8 rb0069a3 28 28 29 29 30 \subsection{C \ lstinline{const}}30 \subsection{C \texorpdfstring{\lstinline{const}}{const}} 31 31 \label{s:Cconst} 32 32 … … 233 233 234 234 235 \section{\ CFA}235 \section{\texorpdfstring{\CFA}{Cforall}} 236 236 237 237 \CFA in \emph{not} an object-oriented programming-language, \ie functions cannot be nested in aggregate types, and hence, there is no \newterm{receiver} notation for calling functions, \eg @obj.method(...)@, where the first argument proceeds the call and becomes an implicit first (\lstinline[language=C++]{this}) parameter. -
doc/theses/jiada_liang_MMath/conclusion.tex
r92a0ee8 rb0069a3 2 2 \label{c:conclusion} 3 3 4 The goal of this thesis is to adapt enumeration in \CFA to be aligned with the analogous features in 5 other languages while being backward-compatiable to C. 6 The presented features are based off on tools and techniques that widely used in 7 other languages but they were adapted to better fix \CFA's feature set. Additionally, the thesis provides 8 an improvement on safety and productivity of C enumeration, including enumerator overloading, 9 name scoping and type checking. 4 The goal of this work is to extend the simple and unsafe enumeration type in the C programming-language into a complex and safe enumeration type in the \CFA programming-language, while maintaining backwards compatibility with C. 5 Within this goal, the new \CFA enumeration should align with the analogous enumeration features in other languages to match modern programming expectations. 6 Hence, the \CFA enumeration features are burrowed from a number of programming languages, but engineered to work and play with \CFA's type system and feature set. 10 7 11 To further explores the potential of enumerated types, this thesis presents a new \CFA enumeration 12 that is independent on C enumeration. The \CFA enumeration aims to solve the data harmonization problem 13 and have natural support to \CFA generic type, along with some new features that fit with \CFA's 14 programming pattern, such as enumerator conctrol structures. 8 Additional safety is provided by strong type-checking of enumeration initialization and assignment, ensuring an enumeration only contains its enumerators. 9 Overloading and scoping of enumerators significantly reduces the naming problem, providing a better software-engineering environment, with fewer name clashes and the ability to disambiguate those that cannot be implicitly resolved. 10 Typed enumerations solve the data-harmonization problem increasing safety through better software engineering. 11 As well, integrating enumerations with existing control structures provides a consistent upgrade for programmers, and a succinct and secure mechanism to enumerate with the new loop-range feature. 12 Generalization and reuse are supported by incorporating the new enumeration type using the \CFA trait system. 13 Enumeration traits define the meaning of an enumeration, allowing functions to be written that work on any enumeration, such as the reading and printing an enumeration. 14 Using advanced duck typing, existing C enumerations can be extended so they work with all of the enumeration features, providing for legacy C code to be moved forward into the modern \CFA programming domain. 15 Finally, I expanded the \CFA project's test-suite with multiple enumeration features tests, with respect to implicit conversions, control structures, inheritance, interaction with the polymorphic types, and the features built on top of enumeration traits. 16 These tests ensure future \CFA work does not accidently break the new enumeration system. 15 17 16 The \CFA project's test suite has been expanded to test the enumerations with respect to its 17 implicit conversions, inheritance, interaction with the polymorphic types, and the features 18 built on top of enumeration traits. 18 The conclusion is that the new \CFA enumeration mechanisms achieves the initial goals, providing C programmers with an intuitive enumeration mechanism for handling modern programming requirements. 19 19 20 The enumerated type is an attempt to adapt classic data types into \CFA unique type system. It brings21 valuable new feature to \CFA in its own right, but also serve as a motivation to adapt other data types22 in \CFA.23 20 24 %\section{Future Work}21 \section{Future Work} 25 22 23 There are still corner cases being found in the current \CFA enumeration implementation. 24 Fixing some of these corner cases, requires changes to the \CFA resolver or extensions to \CFA, like compile-time constant-expression evaluation. 25 When these changes are made, it should be straightforward to update the \CFA enumeration implementation to work with them. 26 27 Currently, some aspects of the enumeration trait system require explicitly including file @enum.hfa@, which easily leads to problems. 28 It should be possible to have this file included implicitly by updating the \CFA prelude. 29 30 C already provides @const@-style aliasing using the \emph{unnamed} enumerator \see{\VRef{s:TypeName}}, even if the name @enum@ is misleading (@const@ would be better). 31 Given the existence of this form, it is conceivable to extend it with types other than @int@. 32 \begin{cfa} 33 enum { Size = 20u, PI = 3.14159L, Jack = L"John" }; 34 \end{cfa} 35 which matches with @const@ aliasing in other programming languages. 36 Here, the type of the enumerator is the type of the initialization constant, \eg @typeof( 20u )@ for @Size@ implies @unsigned int@. 37 Auto-initialization is restricted to the case where all constants are @int@, matching with C. 38 As seen in \VRef{s:EnumeratorTyping}, this feature is just a shorthand for multiple typed-enumeration declarations. 39 \begin{cfa} 40 enum( unsigned int ) { Size = 20u }; 41 enum( long double ) { PI = 3.14159L }; 42 enum( wchar_t * ) { Jack = L"John" }; 43 \end{cfa} -
doc/theses/jiada_liang_MMath/relatedwork.tex
r92a0ee8 rb0069a3 448 448 449 449 450 \section{C\ raisebox{-0.7ex}{\LARGE$^\sharp$}\xspace} % latex bug: cannot use \relsize{2} so use \LARGE450 \section{C\texorpdfstring{\raisebox{-0.7ex}{\LARGE$^\sharp$}\xspace}{Csharp}} % latex bug: cannot use \relsize{2} so use \LARGE 451 451 \label{s:Csharp} 452 452 -
doc/theses/jiada_liang_MMath/trait.tex
r92a0ee8 rb0069a3 24 24 25 25 26 \section{Traits \ lstinline{CfaEnum} and \lstinline{TypedEnum}}26 \section{Traits \texorpdfstring{\lstinline{CfaEnum}{CfaEnum}} and \texorpdfstring{\lstinline{TypedEnum}}{TypedEnum}} 27 27 28 28 Traits @CfaEnum@ and @TypedEnum@ define the enumeration attributes: @label@, @posn@, @value@, and @Countof@. … … 84 84 85 85 Other types may work with traits @CfaEnum@ and @TypedEnum@, by supplying appropriate @label@, @posn@, and @value@ functions. 86 For example, \VRef[Figure]{f: GeneralizedEnumerationFormatter} extends a (possibly predefined) C enumeration to work with all the \CFA extensions.86 For example, \VRef[Figure]{f:ExtendCEnumeration} extends a (possibly predefined) C enumeration to work with all the \CFA extensions. 87 87 88 88 \begin{figure} … … 100 100 sout | format_enum( Cherry ); $\C{// "Cherry(c)"}$ 101 101 \end{cfa} 102 \caption{ Generalized Enumeration Formatter}103 \label{f: GeneralizedEnumerationFormatter}102 \caption{Extend C Enumeration to \CFA Enumeration} 103 \label{f:ExtendCEnumeration} 104 104 \end{figure} 105 105
Note: See TracChangeset
for help on using the changeset viewer.