Ignore:
Timestamp:
Aug 4, 2024, 11:47:20 AM (2 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
065de93
Parents:
b797fe36
Message:

merge local changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/jiada_liang_MMath/background.tex

    rb797fe36 r1697c40  
    232232While C provides a true enumeration, it is restricted, has unsafe semantics, and does not provide useful/advanced enumeration features found in other programming languages.
    233233
     234\section{\CFA Polymorphism}
     235
     236\subsection{Function Overloading}
     237Function 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
     238with different entities as long as they are different in terms of the number and type of parameters.
    234239
    235240\section{\CFA}
     
    371376The 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.
    372377
     378\subsection{Trait}
     379A @forall@ clause can asserts on multiple types and with multiple asserting functions. A common practice in \CFA is to group
     380the asserting functions in to a named \newterm{trait}.
    373381
    374382\subsection{Trait}
     
    448456
    449457In 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 Bilson
    452 \item @poly@
    453 \item @safe@
    454 \item @sign@ is the number of sign/unsigned variable conversions
    455 \item @vars@ is the number of polymorphic type variables
    456 \item @specialization@ is a negative value of the number of type assertions
    457 \item @reference@ is the number of reference-to-rvalue conversions
    458 \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}
    459467The extended conversion-cost model looks for candidates that are more specific and less generic.
    460468@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.
     
    467475\CFA defines two special cost values: @zero@ and @infinite@.
    468476A 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@.
     477For example, the conversion cost from @int@ to a @struct S@ is @infinite@.
     478
     479In \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.
     480Cast 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
     481infinite conversion cost and non-infinite cast cost.
Note: See TracChangeset for help on using the changeset viewer.