Changes in / [3d8f2f8:e84382b]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/Paper.tex
r3d8f2f8 re84382b 602 602 [ q, r ] = div( 13.5, 5.2 ); $\C{// assign into tuple}$ 603 603 \end{cfa} 604 Clearly, this approach is straightforward to understand and use;604 This approach is straightforward to understand and use; 605 605 therefore, why do few programming languages support this obvious feature or provide it awkwardly? 606 T he answer is thatthere are complex consequences that cascade through multiple aspects of the language, especially the type-system.606 To answer, there are complex consequences that cascade through multiple aspects of the language, especially the type-system. 607 607 This section show these consequences and how \CFA handles them. 608 608 … … 823 823 where @[5, "hello"]@ is flattened, giving argument list @5, "hello"@, and @T@ binds to @int@ and @U@ binds to @const char@. 824 824 Tuples, however, may contain polymorphic components. 825 For example, a plus operator can be written to add two triples together.825 For example, a plus operator can be written to sum two triples. 826 826 \begin{cfa} 827 827 forall( otype T | { T ?+?( T, T ); } ) [T, T, T] ?+?( [T, T, T] x, [T, T, T] y ) { … … 857 857 As such, @ttype@ variables are also called \newterm{argument packs}. 858 858 859 Like variadic templates, the main way to manipulate @ttype@ polymorphic functions isvia recursion.859 Like variadic templates, @ttype@ polymorphic functions are primarily manipulated via recursion. 860 860 Since nothing is known about a parameter pack by default, assertion parameters are key to doing anything meaningful. 861 861 Unlike variadic templates, @ttype@ polymorphic functions can be separately compiled. 862 For example, a generalized @sum@ function written using @ttype@:862 For example, a generalized @sum@ function: 863 863 \begin{cfa} 864 864 int sum$\(_0\)$() { return 0; } … … 2658 2658 We justify the given line count by noting that many object-oriented languages do not allow implementing new interfaces on library types without subclassing or wrapper types, which may be similarly verbose. 2659 2659 2660 Raw line-count, however,is a fairly rough measure of code complexity;2661 another important factor is how much type information the programmer must manually specify, especially where that information is not checked by the compiler.2660 Line-count is a fairly rough measure of code complexity; 2661 another important factor is how much type information the programmer must specify manually, especially where that information is not compiler-checked. 2662 2662 Such unchecked type information produces a heavier documentation burden and increased potential for runtime bugs, and is much less common in \CFA than C, with its manually specified function pointer arguments and format codes, or \CCV, with its extensive use of untype-checked downcasts, \eg @object@ to @integer@ when popping a stack. 2663 2663 To quantify this manual typing, the ``redundant type annotations'' line in Table~\ref{tab:eval} counts the number of lines on which the type of a known variable is respecified, either as a format specifier, explicit downcast, type-specific function, or by name in a @sizeof@, struct literal, or @new@ expression. … … 2776 2776 Finally, we demonstrate that \CFA performance for some idiomatic cases is better than C and close to \CC, showing the design is practically applicable. 2777 2777 2778 There is ongoing work on a wide range of \CFA feature extensions, including arrays with size, runtime type-information, virtual functions, user-defined conversions, concurrent primitives, and modules.2779 (While all examples in the paper compile and run, a public beta-release of \CFA will take another 8--12 months to finalize these additional extensions.) 2780 In addition, there areinteresting future directions for the polymorphism design.2778 There is ongoing work on a wide range of \CFA features, including arrays with size, runtime type-information, virtual functions, user-defined conversions, concurrent primitives, and modules. 2779 While all examples in the paper compile and run, a public beta-release of \CFA will take another 8--12 months to finalize these extensions. 2780 There are also interesting future directions for the polymorphism design. 2781 2781 Notably, \CC template functions trade compile time and code bloat for optimal runtime of individual instantiations of polymorphic functions. 2782 2782 \CFA polymorphic functions use dynamic virtual-dispatch;
Note:
See TracChangeset
for help on using the changeset viewer.