Changeset b51e5fdb for doc/papers/general
- Timestamp:
- Mar 9, 2018, 1:33:19 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- e84382b
- Parents:
- f86c8e5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/Paper.tex
rf86c8e5 rb51e5fdb 592 592 [ q, r ] = div( 13.5, 5.2 ); $\C{// assign into tuple}$ 593 593 \end{cfa} 594 Clearly, this approach is straightforward to understand and use;594 This approach is straightforward to understand and use; 595 595 therefore, why do few programming languages support this obvious feature or provide it awkwardly? 596 T he answer is thatthere are complex consequences that cascade through multiple aspects of the language, especially the type-system.596 To answer, there are complex consequences that cascade through multiple aspects of the language, especially the type-system. 597 597 This section show these consequences and how \CFA handles them. 598 598 … … 813 813 where @[5, "hello"]@ is flattened, giving argument list @5, "hello"@, and @T@ binds to @int@ and @U@ binds to @const char@. 814 814 Tuples, however, may contain polymorphic components. 815 For example, a plus operator can be written to add two triples together.815 For example, a plus operator can be written to sum two triples. 816 816 \begin{cfa} 817 817 forall( otype T | { T ?+?( T, T ); } ) [T, T, T] ?+?( [T, T, T] x, [T, T, T] y ) { … … 847 847 As such, @ttype@ variables are also called \newterm{argument packs}. 848 848 849 Like variadic templates, the main way to manipulate @ttype@ polymorphic functions isvia recursion.849 Like variadic templates, @ttype@ polymorphic functions are primarily manipulated via recursion. 850 850 Since nothing is known about a parameter pack by default, assertion parameters are key to doing anything meaningful. 851 851 Unlike variadic templates, @ttype@ polymorphic functions can be separately compiled. 852 For example, a generalized @sum@ function written using @ttype@:852 For example, a generalized @sum@ function: 853 853 \begin{cfa} 854 854 int sum$\(_0\)$() { return 0; } … … 2648 2648 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. 2649 2649 2650 Raw line-count, however,is a fairly rough measure of code complexity;2651 another important factor is how much type information the programmer must manually specify, especially where that information is not checked by the compiler.2650 Line-count is a fairly rough measure of code complexity; 2651 another important factor is how much type information the programmer must specify manually, especially where that information is not compiler-checked. 2652 2652 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. 2653 2653 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. … … 2766 2766 Finally, we demonstrate that \CFA performance for some idiomatic cases is better than C and close to \CC, showing the design is practically applicable. 2767 2767 2768 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.2769 (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.) 2770 In addition, there areinteresting future directions for the polymorphism design.2768 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. 2769 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. 2770 There are also interesting future directions for the polymorphism design. 2771 2771 Notably, \CC template functions trade compile time and code bloat for optimal runtime of individual instantiations of polymorphic functions. 2772 2772 \CFA polymorphic functions use dynamic virtual-dispatch;
Note: See TracChangeset
for help on using the changeset viewer.