Ignore:
Timestamp:
Aug 4, 2024, 12:23:00 PM (2 months ago)
Author:
Peter A. Buhr <pabuhr@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    ra57ad8a r748877f  
    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}
     
    387392The 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.
    388393
     394\subsection{Trait}
     395A @forall@ clause can asserts on multiple types and with multiple asserting functions. A common practice in \CFA is to group
     396the asserting functions in to a named \newterm{trait}.
    389397
    390398\subsection{Trait}
     
    464472
    465473In 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 Bilson
    468 \item @poly@
    469 \item @safe@
    470 \item @sign@ is the number of sign/unsigned variable conversions
    471 \item @vars@ is the number of polymorphic type variables
    472 \item @specialization@ is a negative value of the number of type assertions
    473 \item @reference@ is the number of reference-to-rvalue conversions
    474 \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}
    475483The extended conversion-cost model looks for candidates that are more specific and less generic.
    476484@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.
     
    483491\CFA defines two special cost values: @zero@ and @infinite@.
    484492A 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@.
     493For example, the conversion cost from @int@ to a @struct S@ is @infinite@.
     494
     495In \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.
     496Cast 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
     497infinite conversion cost and non-infinite cast cost.
Note: See TracChangeset for help on using the changeset viewer.