Changeset c1c0efdb for doc/theses/jiada_liang_MMath/conclusion.tex
- Timestamp:
- Aug 8, 2024, 10:02:34 PM (2 months ago)
- Branches:
- master
- Children:
- 7568e5c
- Parents:
- 11cced6
- git-author:
- Peter A. Buhr <pabuhr@…> (08/08/24 22:01:56)
- git-committer:
- Peter A. Buhr <pabuhr@…> (08/08/24 22:02:34)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/jiada_liang_MMath/conclusion.tex
r11cced6 rc1c0efdb 13 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 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 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 16 These tests ensure future \CFA work does not accidentally break the new enumeration system. 17 17 … … 21 21 \section{Future Work} 22 22 23 The following are ideas to improve and extend the work in this thesis. 24 \begin{enumerate} 25 \item 23 26 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.27 Fixing some of these corner cases requires changes to the \CFA resolver or extensions to \CFA. %, like compile-time constant-expression evaluation. 25 28 When these changes are made, it should be straightforward to update the \CFA enumeration implementation to work with them. 26 29 \item 27 30 Currently, some aspects of the enumeration trait system require explicitly including the file @enum.hfa@, which can lead to problems. 28 31 It should be possible to have this file included implicitly by updating the \CFA prelude. 29 32 \item 33 There are multiple \CFA features being developed i parallel with enumerations. 34 Two closely related features are iterator and namespace. 35 Enumerations may have to be modified to dovetail with these features. 36 For example, enumerating with range loops does not align with the current iterator design, so some changes will be necessary. 37 \item 30 38 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 39 Given the existence of this form, it is conceivable to extend it with types other than @int@. … … 42 50 enum( wchar_t * ) { Jack = L"John" }; 43 51 \end{cfa} 44 There are several new features have been proposed or are developing in parallel with enumerations. 45 Two closely related features are iterator and namespace. 46 47 Enumerating features, and range loops in particular, are currently implemented as loops unique to \CFA enumeration and do not align with the 48 general iterator pattern. They can be adapted to the iterator interface when it comes to maturity. 49 50 Currently, \CFA implements a namespace feature for enumerated types only. There is recently a proposal by Andrew to 51 generalize the concept of namespace to other types. The enumeration scope will be revisited to follow the semantics 52 with other types. Also to improve the granularity of scope control, we propose the following extension: 52 \item 53 Currently enumeration scoping is all or nothing. 54 In some cases, it might be useful to increase the scoping granularity to individual enumerators. 53 55 \begin{cfa} 54 56 enum E1 { @!@A, @^@B, C }; 55 57 enum E2 @!@ { @!@A, @^@B, C }; 56 58 \end{cfa} 57 which provides a combination of scoped and unscoped enumerators.59 Here, @'!'@ means the enumerator is scoped, and @'^'@ means the enumerator is unscoped. 58 60 For @E1@, @A@ is scoped; @B@ and @C@ are unscoped. 59 61 For @E2@, @A@, and @C@ are scoped; @B@ is unscoped. 60 Finding a use case is important to justify completing this extension. 62 Finding a use case is important to justify this extension. 63 \item 64 An extension mentioned in \VRef{s:Ada} is using @typedef@ to create an enumerator alias. 65 \begin{cfa} 66 enum(int) RGB { @Red@, @Green@, Blue }; 67 enum(int) Traffic_Light { @Red@, Yellow, @Green@ }; 68 typedef RGB.Red OtherRed; // alias 69 \end{cfa} 70 \end{enumerate}
Note: See TracChangeset
for help on using the changeset viewer.