Changeset 206f4cf


Ignore:
Timestamp:
May 19, 2025, 3:01:48 PM (4 weeks ago)
Author:
Fangren Yu <f37yu@…>
Branches:
master
Children:
00ad2a0
Parents:
8b3109b
Message:

proofreading fixes

File:
1 edited

Legend:

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

    r8b3109b r206f4cf  
    88Haskell~\cite{Haskell10} combines ML-style polymorphism, polymorphic data types, and type inference with the notion of type classes, collections of overloadable methods.
    99The class/type-class association constrain type arguments by indicating the set of functions that become implicit assertion arguments and specify the implementation of these operations.
    10 As pointed out \see{\VRef[Figure]{f:ImplicitExplicitTraitInferencing}}, Haskell requires an explicit association between types and constrains (type-class).
     10As pointed out \see{\VRef[Figure]{f:ImplicitExplicitTraitInferencing}}, Haskell requires an explicit association between types and constraints (type-class).
    1111Otherwise, Haskell does not provide general overloading.
    1212\CFA differs by allowing general overloading and constraining type arguments with traits.
     
    1616Selecting among them and understanding how they interact is part of the challenge in \CC program development.
    1717General overloading is available, subtyping inheritance can be single or multiple, templates are typed macro-expansion over a universal type, which precludes separate compilation.
    18 Universal template types are constrained using @concept@s~\cite{C++Concepts}, but only as a guideline, as the template expansion can still discover additional constrains.
     18Universal template types are constrained using @concept@s~\cite{C++Concepts}, but only as a guideline, as the template expansion can still discover additional constraints.
    1919Template expansion can result in code bloat and poor error messages.
    2020Type inferencing is available using \lstinline[language=C++]{auto}, precluding using the return type for overload selection.
    21 \CFA differs by providing a simplified, uniform facility for polymorphic code, eliminating subtyping polymorphic, and encompassing overloading among parametric functions and universal (generic) types, all of which are separately compilable.
     21\CFA differs by providing a simplified, uniform facility for polymorphic code, eliminating subtyping polymorphism, and encompassing overloading among parametric functions and universal (generic) types, all of which are separately compilable.
    2222Overload resolution uses the return type and arithmetic conversions to make precise function selections versus generating ambiguities, at the cost of type inferencing.
    2323Both \CFA call-site inferencing and \CC template expansion search in the local environment to satisfy explicit assertions or to find named functions to complete the template, respectively.
     
    4040\CFA's path for modernizing works with the existing C type system and runtime, \ie not adding object-oriented types or garbage collection.
    4141Java~\cite{Java8} has object-oriented subtyping, generic @interface@s that act like traits, which are type checked at compilation and type erased at runtime similar to \CFA's, and general overloading on methods.
    42 However, in Java, each object carries its own table of method pointers, whereas \CFA passes trait pointers at call-site maintaining a C-compatible layout.
     42However, in Java, each class carries its own table of method pointers, and use of interfaces must be pre-declared with the @implements@ keyword, whereas \CFA passes trait pointers at call-site maintaining a C-compatible layout.
    4343Java is also garbage-collected.
    4444
     
    4848Go's generic types and functions are limited to a small fixed-set provided by the compiler, with no language facility to define more.
    4949Rust also possesses more powerful abstraction capabilities for writing generic code than Go.
    50 While Rust's borrow checker provides strong safety guarantees, it is complex and difficult to learn and imposes a distinctly idiomatic programming style different than C.
    51 \CFA, with its modest safety features, has a comparable type-system to Rust's, while maintaining C backwards compatibility, providing a modernization path for existing C code-bases.
     50While Rust's borrow checker provides strong safety guarantees, it is complex and difficult to learn, and imposes a distinctly idiomatic programming style different from C.
     51\CFA, with its modest safety features, has a comparable type-system to Rust's that also maintains C backwards compatibility, which provides a modernization path for existing C code-bases.
    5252
    5353
     
    6666While \CFA has some structured-tuple capabilities, \VRef{s:TupleImplementation}, my analysis suggests this feature might be removed.
    6767
    68 An alternative to a tuple type is of variadic (variable argument) functions or type.
     68An alternative to tuple types is variadic (variable number of arguments) functions or types.
    6969C provides variadic functions through @va_list@ objects, but the programmer is responsible for managing the number of arguments and their types;
    7070thus, the mechanism is type unsafe.
     
    7272Tuples are a generalization of @std::pair@ allowing for arbitrary length, fixed-size aggregation of heterogeneous values.
    7373Operations include @std::get<N>@ to extract values, @std::tie@ to create a tuple of references used for assignment, and lexicographic comparisons.
    74 \CC{17} proposes \emph{structured bindings}~\cite{Sutter15} to eliminate predeclaring variables and the use of @std::tie@ for binding the results.
     74\CC{17} proposes \emph{structured bindings}~\cite{Sutter15} to eliminate pre-declaring variables and the use of @std::tie@ for binding the results.
    7575This extension requires the use of @auto@ to infer the types of the new variables; hence, complicated expressions with a nonobvious type must be documented with some other mechanism.
    7676Furthermore, structured bindings are not a full replacement for @std::tie@, as it always declares new variables.
    7777Java's variadic functions appear similar to C's but are type safe using homogeneous arrays.
    78 \CFA's heterogeneous variadic-functions \see{\VPageref{p:VariadicFunctions}} provide a type-safe version of C variadic, although limited in features, which fits into the overall \CFA type-system design.
     78\CFA's heterogeneous variadic functions \see{\VPageref{p:VariadicFunctions}} provide a type-safe version of C variadic, although limited in features, which fits into the overall \CFA type-system design.
    7979
    8080
Note: See TracChangeset for help on using the changeset viewer.