- Timestamp:
- Feb 4, 2025, 9:17:13 PM (7 weeks ago)
- Branches:
- master
- Children:
- 332e93a
- Parents:
- 7846f91
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified doc/theses/fangren_yu_MMath/content2.tex ¶
r7846f91 r985ff5f 55 55 In addition, fixing unexpected interactions within the type system has presented challenges. 56 56 This chapter describes in detail the type-resolution rules currently in use and some major problems that have been identified. 57 Not all of those problems have solutions, because fixing them may require redesigning parts of the \CFA type system at a larger scale, which correspondingly affects the language design.57 Not all of those problems have immediate solutions, because fixing them may require redesigning parts of the \CFA type system at a larger scale, which correspondingly affects the language design. 58 58 59 59 … … 62 62 \CFA has been using a total-order expression cost-model to resolve ambiguity of overloaded expressions from the very beginning. 63 63 Most \CFA operators can be overloaded in \CFA\footnote{ 64 \CFA excludes overloading the comma operator, short-circuit logical operators \lstinline{&&} and \lstinline{||} (control structures), and ternary conditional operator \lstinline{?} (control structure).65 \CC overloads the comma and short-circuit logical operators, where the overloaded short-circuit operators do not exhibit short-circuit semantics, which is confusing.};64 \CFA excludes overloading the comma operator, short-circuit logical operators \lstinline{&&} and \lstinline{||}, and ternary conditional operator \lstinline{?}, all of which are short-hand control structures rather than operators. 65 \CC overloads the comma and short-circuit logical operators, where the overloaded comma is esoteric short-circuit operators do not exhibit short-circuit semantics, which is confusing.}; 66 66 hence, they are treated the same way as other function calls with the same rules for overload resolution. 67 67 … … 78 78 At a subexpression level, the lowest cost candidate for each result type is included as a possible interpretation of the expression; 79 79 at the top level, all possible interpretations of different types are considered (generating a total ordering) and the overall lowest cost is selected as the final interpretation of the expression. 80 Glen Ditchfield first proposed this costing model~\cite[\S~4.4.5]{Ditchfield92} to generate a resolution behaviour that is reasonable to C programmers based on existing conversions in the language.80 Glen Ditchfield first proposed this costing model~\cite[\S~4.4.5]{Ditchfield92} to generate a resolution behaviour that is reasonable to C programmers based on existing conversions in the C programming language. 81 81 This model carried over into the first implementation of the \CFA type-system by Richard Bilson~\cite[\S~2.2]{Bilson03}, and was extended but not redesigned by Aaron Moss~\cite[chap.~4]{Moss19}. 82 82 Moss's work began to show problems with the underlying costing model; … … 114 114 In many languages that support function/method overloading, such as \CC and Java, a partial-order system decides which interpretation of the expression gets selected. 115 115 Hence, sometimes the candidates are incomparable (none are considered a better match), and only when one candidate is considered better than all others (maximal with respect to the partial order) is the expression unambiguous. 116 Specifically, the resolution algorithms used in \CC and Java are greedy, as they select the best match for each sub-expression without considering the higher level ones, and therefore at each step of resolution, the arguments are already given unique interpretations, so the ordering only needs to consider comparing different sets of conversion targets (function parameter types) on the same set of input. 116 Specifically, the resolution algorithms used in \CC and Java are greedy, selecting the best match for each sub-expression without considering the higher-level ones (bottom-up). 117 Therefore, at each resolution step, the arguments are already given unique interpretations, so the ordering only needs to compare different sets of conversion targets (function parameter types) on the same set of input. 117 118 \begin{cfa} 118 119 @generate a C++ example here@
Note: See TracChangeset
for help on using the changeset viewer.