Changeset 7846f91 for doc


Ignore:
Timestamp:
Feb 4, 2025, 9:16:19 PM (3 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
985ff5f
Parents:
bbbff10
Message:

start adding table overload discriminating features

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified doc/theses/fangren_yu_MMath/intro.tex

    rbbbff10 r7846f91  
    4343
    4444Virtually all programming languages overload the arithmetic operators across the basic computational types using the number and type of parameters and returns.
    45 Like \CC, \CFA maps operators to named functions and allows these operators to be overloaded with user-defined types.
     45However, in many programming languages, arithmetic operators are not first class, and hence, they cannot be overloaded by programmers.
     46Like \CC, \CFA maps operators to named functions allowing them to be overloaded with user-defined types.
    4647The syntax for operator names uses the @'?'@ character to denote a parameter, \eg left and right unary operators: @?++@ and @++?@, and binary operators @?+?@ and @?<=?@.
    4748Here, a user-defined type is extended with an addition operation with the same syntax as a builtin type.
     
    171172
    172173
     174\section{Overload Resolution Strategies}
     175
     176For languages with user-defined overloading,
     177Given an overloaded constant, variable, or (generic) function, there must exist strategies for differentiating among them and selecting the most appropriate one in a given context.
     178The criteria commonly used to match operator/function/method names with definitions are: number of parameters, parameter types, parameter order or name, return type, implicit argument type conversions (safe/unsafe), generic, where some features are missing in certain programming languages.
     179\VRef[Table]{t:OverloadingFeatures} shows a subset of popular programming languages with overloading and the discriminating features used to disambiguate among overloadings.
     180Language C, Go and Rust have no overloading beyond basic types and operators.
     181
     182\begin{table}
     183\caption{Overload Discriminating Features in Programming Languages}
     184\label{t:OverloadingFeatures}
     185\centering
     186
     187
     188\begin{minipage}{0.75\textwidth}
     189\begin{tabular}{@{}r|ccccccc@{}}
     190Feat.\,{\textbackslash}\,Lang.  & Ada   & \CC   & \CFA  & Java  & Scala & Swift & Haskell       \\
     191\hline
     192Oper./Func./Meth. name  & O\footnote{except assignment}/F       & O/F/M & O/F   & M     & O/M   & O/F/M \\
     193\# of parameters                & yes   & yes   & yes   & yes   & yes   & yes   \\
     194parameter types                 & yes   & yes   & yes   & yes   & yes   & yes   \\
     195parameter Order/Name    & O/N   & O             & O             & O             &               & O/N   \\
     196return type                             & yes   & no    & yes   & no    &               & yes   \\
     197Safe/Unsafe arg. conv.  &               &               & S/U   &               &               & no\footnote{literals only, Int -> Double (Safe)}      \\
     198generic                                 &               &               & yes   &               &               & yes
     199\end{tabular}
     200\end{minipage}
     201\end{table}
     202
     203
    173204\section{Type Inferencing}
    174205\label{s:IntoTypeInferencing}
Note: See TracChangeset for help on using the changeset viewer.