Changeset c9c1a7e6 for doc/theses/fangren_yu_MMath/intro.tex
- Timestamp:
- May 3, 2025, 8:06:20 AM (5 months ago)
- Branches:
- master
- Children:
- f466d6b
- Parents:
- 99a7163 (diff), 57c7e6c4 (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/fangren_yu_MMath/intro.tex
r99a7163 rc9c1a7e6 35 35 \end{quote} 36 36 Overloading allows programmers to use the most meaningful names without fear of name clashes within a program or from external sources, like include files. 37 Experience from \CC and \CFA developers shows the type system can implicitly and correctly disambiguate sthe majority of overloaded names, \ie it is rare to get an incorrect selection or ambiguity, even among hundreds of overloaded (variables and) functions.37 Experience from \CC and \CFA developers shows the type system can implicitly and correctly disambiguate the majority of overloaded names, \ie it is rare to get an incorrect selection or ambiguity, even among hundreds of overloaded (variables and) functions. 38 38 In many cases, a programmer is unaware of name clashes, as they are silently resolved, simplifying the development process. 39 39 … … 445 445 f( 'A' ); $\C{// select (2)}\CRT$ 446 446 \end{cfa} 447 The type system examines each call si ze and first looks for an exact match and then a best match using conversions.447 The type system examines each call site and first looks for an exact match and then a best match using conversions. 448 448 449 449 Ada, Scala, and \CFA type-systems also use the return type in resolving a call, to pinpoint the best overloaded name. 450 Essent ailly, the return types are \emph{reversed curried} into output parameters of the function.450 Essentially, the return types are \emph{reversed curried} into output parameters of the function. 451 451 For example, in many programming languages with overloading, the following functions are ambiguous without using the return type. 452 452 \begin{cfa} … … 643 643 For example, if a change is made in an initialization expression, it can cascade type changes producing many other changes and/or errors. 644 644 At some point, a variable's type needs to remain constant and the initializing expression needs to be modified or be in error when it changes. 645 Often type-inferencing systems allow restricting (\newterm{branding}) a variable or function type, so the comp lier can report a mismatch with the constant initialization.645 Often type-inferencing systems allow restricting (\newterm{branding}) a variable or function type, so the compiler can report a mismatch with the constant initialization. 646 646 \begin{cfa} 647 647 void f( @int@ x, @int@ y ) { // brand function prototype … … 795 795 \end{tabular} 796 796 \end{cquote} 797 Traits are implemented by flatten them at use points, as if written in full by the programmer.797 Traits are implemented by flattening them at use points, as if written in full by the programmer. 798 798 Flattening often results in overlapping assertions, \eg operator @+@. 799 799 Hence, trait names play no part in type equivalence. … … 857 857 \end{tabular} 858 858 \end{cquote} 859 \label{s:GenericImplementation} 859 860 \CFA generic types are \newterm{fixed} or \newterm{dynamic} sized. 860 861 Fixed-size types have a fixed memory layout regardless of type parameters, whereas dynamic types vary in memory layout depending on the type parameters. … … 1009 1010 \end{swift} 1010 1011 To make a universal function useable, an abstract description is needed for the operations used on the parameters within the function body. 1011 Type matching these operations can occur by discoverusing techniques like \CC template expansion, or explicit stating, \eg interfaces, subtyping (inheritance), assertions (traits), type classes, type bounds.1012 Type matching these operations can be done by using techniques like \CC template expansion, or explicit stating, \eg interfaces, subtyping (inheritance), assertions (traits), type classes, type bounds. 1012 1013 The mechanism chosen can affect separate compilation or require runtime type information (RTTI). 1013 1014 \begin{description}
Note:
See TracChangeset
for help on using the changeset viewer.