Changeset 1697c40 for doc/theses/jiada_liang_MMath/background.tex
- Timestamp:
- Aug 4, 2024, 11:47:20 AM (2 months ago)
- Branches:
- master
- Children:
- 065de93
- Parents:
- b797fe36
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/jiada_liang_MMath/background.tex
rb797fe36 r1697c40 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} … … 371 376 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. 372 377 378 \subsection{Trait} 379 A @forall@ clause can asserts on multiple types and with multiple asserting functions. A common practice in \CFA is to group 380 the asserting functions in to a named \newterm{trait}. 373 381 374 382 \subsection{Trait} … … 448 456 449 457 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: 450 \begin{ enumerate}451 \item @unsafe@ from Bilson452 \item @poly@453 \item @safe@454 \item @sign@ is the number of sign/unsigned variable conversions455 \item @vars@ is the number of polymorphic type variables456 \item @specialization@ is a negative value of the number of type assertions457 \item @reference@ is the number of reference-to-rvalue conversions458 \end{ enumerate}458 \begin{itemize} 459 \item \textit{Unsafe} 460 \item \textit{Poly} 461 \item \textit{Safe} 462 \item \textit{Sign} is the number of sign/unsign variable conversion. 463 \item \textit{Vars} is the number of polymorphics type variable. 464 \item \textit{Specialization} is negative value of the number of type assertion. 465 \item \textit{Reference} is number of reference-to-rvalue conversion. 466 \end{itemize} 459 467 The extended conversion-cost model looks for candidates that are more specific and less generic. 460 468 @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. … … 467 475 \CFA defines two special cost values: @zero@ and @infinite@. 468 476 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. 469 For example, the conversion cost from @int@ to a @struct S@ is @infinite@. 477 For example, the conversion cost from @int@ to a @struct S@ is @infinite@. 478 479 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. 480 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 481 infinite conversion cost and non-infinite cast cost.
Note: See TracChangeset
for help on using the changeset viewer.