Changeset 748877f for doc/theses/jiada_liang_MMath/background.tex
- Timestamp:
- Aug 4, 2024, 12:23:00 PM (2 months ago)
- Branches:
- master
- Children:
- 7ab24fef
- Parents:
- a57ad8a (diff), 065de93 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/jiada_liang_MMath/background.tex
ra57ad8a r748877f 232 232 While C provides a true enumeration, it is restricted, has unsafe semantics, and does not provide useful/advanced enumeration features found in other programming languages. 233 233 234 \section{\CFA Polymorphism} 235 236 \subsection{Function Overloading} 237 Function overloading is programming languages feature wherein functions may share the same name, but with different function signatures. In both C++ and \CFA, function names can be overloaded 238 with different entities as long as they are different in terms of the number and type of parameters. 234 239 235 240 \section{\CFA} … … 387 392 The assertion on @T@ restricts the range of types that can be manipulated by @bar@ to only those that have an implementation of @foo@ with the matching signature, allowing @bar@'s call to @foo@ in its body. 388 393 394 \subsection{Trait} 395 A @forall@ clause can asserts on multiple types and with multiple asserting functions. A common practice in \CFA is to group 396 the asserting functions in to a named \newterm{trait}. 389 397 390 398 \subsection{Trait} … … 464 472 465 473 In the next iteration of \CFA, Schluntz and Aaron~\cite{Moss18} expanded conversion cost to a 7-tuple with 4 additional categories, @(unsafe, poly, safe, sign, vars, specialization, reference)@, with the following interpretations: 466 \begin{ enumerate}467 \item @unsafe@ from Bilson468 \item @poly@469 \item @safe@470 \item @sign@ is the number of sign/unsigned variable conversions471 \item @vars@ is the number of polymorphic type variables472 \item @specialization@ is a negative value of the number of type assertions473 \item @reference@ is the number of reference-to-rvalue conversions474 \end{ enumerate}474 \begin{itemize} 475 \item \textit{Unsafe} 476 \item \textit{Poly} 477 \item \textit{Safe} 478 \item \textit{Sign} is the number of sign/unsign variable conversion. 479 \item \textit{Vars} is the number of polymorphics type variable. 480 \item \textit{Specialization} is negative value of the number of type assertion. 481 \item \textit{Reference} is number of reference-to-rvalue conversion. 482 \end{itemize} 475 483 The extended conversion-cost model looks for candidates that are more specific and less generic. 476 484 @vars@ disambiguates @forall( T, V ) foo( T, V )@ and @forall( T ) void foo( T, T )@, where the extra type parameter @V@ makes is more generic. … … 483 491 \CFA defines two special cost values: @zero@ and @infinite@. 484 492 A conversion cost is @zero@ when argument and parameter has an exact match, and a conversion cost is @infinite@ when there is no defined conversion between two types. 485 For example, the conversion cost from @int@ to a @struct S@ is @infinite@. 493 For example, the conversion cost from @int@ to a @struct S@ is @infinite@. 494 495 In \CFA, the meaning of a C style cast is determined by its @Cast Cost@. For most cast expression resolution, a cast cost is equal to a conversion cost. 496 Cast cost exists as an independent matrix for conversion that cannot happen implcitly, while being possible with an explicit cast. These conversions are often defined to have 497 infinite conversion cost and non-infinite cast cost.
Note: See TracChangeset
for help on using the changeset viewer.