Ignore:
Timestamp:
Aug 5, 2024, 9:27:42 AM (22 hours ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
94643698
Parents:
7ab24fef
git-author:
Peter A. Buhr <pabuhr@…> (08/05/24 09:26:38)
git-committer:
Peter A. Buhr <pabuhr@…> (08/05/24 09:27:42)
Message:

formatting

Location:
doc/theses/jiada_liang_MMath
Files:
2 edited

Legend:

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

    r7ab24fef r2514d3d7  
    235235
    236236\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 
     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
    238238with different entities as long as they are different in terms of the number and type of parameters.
    239239
     
    381381\end{cfa}
    382382The @identity@ function accepts a value from any type as an argument and returns that value.
    383 At the call size, the type parameter @T@ is bounded to @int@ from the argument @42@. 
    384 
    385 For polymorphic functions to be useful, the @forall@ clause needs \newterm{type assertion}s that restricts the polymorphic types it accepts. 
     383At the call size, the type parameter @T@ is bounded to @int@ from the argument @42@.
     384
     385For polymorphic functions to be useful, the @forall@ clause needs \newterm{type assertion}s that restricts the polymorphic types it accepts.
    386386\begin{cfa}
    387387forall( T @| { void foo( T ); }@ ) void bar( T t ) { @foo( t );@ }
     
    394394\subsection{Trait}
    395395A @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}. 
     396the asserting functions in to a named \newterm{trait}.
    397397
    398398\subsection{Trait}
    399399
    400400A @forall@ clause can assert many restrictions on multiple types.
    401 A common practice is to refactor the assertions into a named \newterm{trait}. 
     401A common practice is to refactor the assertions into a named \newterm{trait}.
    402402\begin{cfa}
    403403forall(T) trait @Bird@ {
     
    434434otherwise, the program becomes littered with many explicit casts, which is not match programmer expectation.
    435435C is an aggressive language as it provides conversions among almost all of the basic types, even when the conversion is potentially unsafe or not meaningful, \ie @float@ to @bool@.
    436 C defines the resolution pattern as ``usual arithmetic conversion''~\cite[\S~6.3.1.8]{C11}, in which C looks for a \newterm{common type} between operands, and converts one or both operands to the common type. 
     436C defines the resolution pattern as ``usual arithmetic conversion''~\cite[\S~6.3.1.8]{C11}, in which C looks for a \newterm{common type} between operands, and converts one or both operands to the common type.
    437437Loosely defined, a common type is a the smallest type in terms of size of representation that both operands can be converted into without losing their precision, called a \newterm{widening} or \newterm{safe conversion}.
    438438
     
    447447@safe@ is sum of the degree of safe (widening) conversions.
    448448\end{enumerate}
    449 Sum of degree is a method to quantify C's integer and floating-point rank. 
     449Sum of degree is a method to quantify C's integer and floating-point rank.
    450450Every pair of widening conversion types is assigned a \newterm{distance}, and distance between the two same type is 0.
    451451For example, the distance from @char@ to @int@ is 2, distance from @int@ to @long@ is 1, and distance from @int@ to @long long int@ is 2.
     
    494494
    495495In \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 
     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
    497497infinite conversion cost and non-infinite cast cost.
  • doc/theses/jiada_liang_MMath/intro.tex

    r7ab24fef r2514d3d7  
    299299\begin{enumerate}
    300300\item
    301 overloading: 
     301overloading:
    302302\item
    303303scoping
Note: See TracChangeset for help on using the changeset viewer.