Changeset 387c9a1 for doc/papers
- Timestamp:
- May 7, 2018, 6:23:40 PM (6 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, with_gc
- Children:
- 5fec3f6, 83034ec
- Parents:
- c5e5109
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/general/Paper.tex
rc5e5109 r387c9a1 59 59 %\DeclareTextCommandDefault{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.1ex}}} 60 60 \renewcommand{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}} 61 62 \renewcommand*{\thefootnote}{\alph{footnote}} % hack because fnsymbol does not work 63 %\renewcommand*{\thefootnote}{\fnsymbol{footnote}} 61 64 62 65 \makeatletter … … 197 200 The C programming language is a foundational technology for modern computing with millions of lines of code implementing everything from commercial operating-systems to hobby projects. 198 201 This installation base and the programmers producing it represent a massive software-engineering investment spanning decades and likely to continue for decades more. 199 Nevertheless, C, first standardized almost fo urty years ago, lacks many features that make programming in more modern languages safer and more productive.202 Nevertheless, C, first standardized almost forty years ago, lacks many features that make programming in more modern languages safer and more productive. 200 203 201 204 The goal of the \CFA project (pronounced ``C-for-all'') is to create an extension of C that provides modern safety and productivity features while still ensuring strong backwards compatibility with C and its programmers. … … 233 236 Love it or hate it, C is extremely popular, highly used, and one of the few systems languages. 234 237 In many cases, \CC is often used solely as a better C. 235 Nevertheless, C, first standardized almost fo urty years ago~\cite{ANSI89:C}, lacks many features that make programming in more modern languages safer and more productive.238 Nevertheless, C, first standardized almost forty years ago~\cite{ANSI89:C}, lacks many features that make programming in more modern languages safer and more productive. 236 239 237 240 \CFA (pronounced ``C-for-all'', and written \CFA or Cforall) is an evolutionary extension of the C programming language that adds modern language-features to C, while maintaining both source and runtime compatibility with C and a familiar programming model for programmers. … … 299 302 The \CFA tests are 290+ files and 27,000+ lines of code. 300 303 The tests illustrate syntactic and semantic features in \CFA, plus a growing number of runtime benchmarks. 301 The tests check for correctness and are used for daily regression testing of commits (3800+).304 The tests check for correctness and are used for daily regression testing of 3800+ commits. 302 305 303 306 Finally, it is impossible to describe a programming language without usages before definitions. … … 348 351 \eg, it cannot implement the example above, because the variables @max@ are ambiguous with the functions @max@. 349 352 Ergonomic limitations of @_Generic@ include the necessity to put a fixed list of supported types in a single place and manually dispatch to appropriate overloads, as well as possible namespace pollution from the dispatch functions, which must all have distinct names. 350 For backwards compatibility, \CFA supports @_Generic@ expressions, but it is an unnecessary mechanism. \TODO{actually implement that}353 \CFA supports @_Generic@ expressions for backwards compatibility, but it is an unnecessary mechanism. \TODO{actually implement that} 351 354 352 355 % http://fanf.livejournal.com/144696.html … … 543 546 \begin{tabular}{@{}l|@{\hspace{\parindentlnth}}l@{}} 544 547 \begin{cfa} 545 forall( otype R, otype S )struct pair {548 `forall( otype R, otype S )` struct pair { 546 549 R first; S second; 547 550 }; … … 1180 1183 case Mon~Thu: // program 1181 1184 1182 case Fri: // program1185 case Fri: // program 1183 1186 wallet += pay; 1184 1187 `fallthrough;` 1185 case Sat: // party1188 case Sat: // party 1186 1189 wallet -= party; 1187 1190 1188 1191 case Sun: // rest 1189 1192 1190 default: //error1193 default: // print error 1191 1194 } 1192 1195 \end{cfa} … … 1196 1199 case Mon: case Tue: case Wed: case Thu: // program 1197 1200 `break;` 1198 case Fri: // program1201 case Fri: // program 1199 1202 wallet += pay; 1200 1203 1201 case Sat: // party1204 case Sat: // party 1202 1205 wallet -= party; 1203 1206 `break;` 1204 1207 case Sun: // rest 1205 1208 `break;` 1206 default: //error1209 default: // print error 1207 1210 } 1208 1211 \end{cfa} … … 1477 1480 If an exception is raised and caught, the handler is run before the finally clause. 1478 1481 Like a destructor (see Section~\ref{s:ConstructorsDestructors}), a finally clause can raise an exception but not if there is an exception being propagated. 1479 Mimicking the @finally@ clause with mechanisms like RAII is non-trivial lywhen there are multiple types and local accesses.1482 Mimicking the @finally@ clause with mechanisms like RAII is non-trivial when there are multiple types and local accesses. 1480 1483 1481 1484 … … 1530 1533 with ( s, t ) { 1531 1534 j + k; $\C{// unambiguous, s.j + t.k}$ 1532 m = 5.0; $\C{// unambiguous, t.m = 5.0}$1533 m = 1; $\C{// unambiguous, s.m = 1}$1534 int a = m; $\C{// unambiguous, a = s.i}$1535 double b = m; $\C{// unambiguous, b = t.m}$1535 m = 5.0; $\C{// unambiguous, s.m = 5.0}$ 1536 m = 1; $\C{// unambiguous, t.m = 1}$ 1537 int a = m; $\C{// unambiguous, a = t.m }$ 1538 double b = m; $\C{// unambiguous, b = s.m}$ 1536 1539 int c = s.i + t.i; $\C{// unambiguous, qualification}$ 1537 (double)m; $\C{// unambiguous, cast }$1540 (double)m; $\C{// unambiguous, cast s.m}$ 1538 1541 } 1539 1542 \end{cfa} … … 1559 1562 and implicitly opened \emph{after} a function-body open, to give them higher priority: 1560 1563 \begin{cfa} 1561 void ?{}( S & s, int `i` ) with ( s ) ` with( $\emph{\color{red}params}$ )` {1564 void ?{}( S & s, int `i` ) with ( s ) `{` `with( $\emph{\color{red}params}$ )` { 1562 1565 s.i = `i`; j = 3; m = 5.5; 1563 } 1566 } `}` 1564 1567 \end{cfa} 1565 1568 Finally, a cast may be used to disambiguate among overload variables in a @with@ expression: … … 1660 1663 \begin{cfa} 1661 1664 `*` int x, y; 1662 int y;1663 \end{cfa} 1664 & 1665 \begin{cfa} 1666 int `*`x, `*`y ;1665 int z; 1666 \end{cfa} 1667 & 1668 \begin{cfa} 1669 int `*`x, `*`y, z; 1667 1670 1668 1671 \end{cfa} … … 1670 1673 \lstMakeShortInline@% 1671 1674 \end{cquote} 1672 The downside of the \CFA semantics is the need to separate regular and pointer declarations. 1675 % The downside of the \CFA semantics is the need to separate regular and pointer declarations. 1676 The separation of regular and pointer declarations by \CFA declarations enforces greater clarity with only slightly more syntax. 1673 1677 1674 1678 \begin{comment} … … 1792 1796 * [ * int, int ] ( int ) jp; $\C{// pointer to function returning pointer to int and int with int parameter}$ 1793 1797 \end{cfa} 1794 Note, a function name cannot be specified: 1795 \begin{cfa} 1796 * [ int x ] f () fp; $\C{// function name "f" is disallowed}\CRT$ 1797 \end{cfa} 1798 Note, the name of the function pointer is specified last, as for other variable declarations. 1798 1799 1799 1800 Finally, new \CFA declarations may appear together with C declarations in the same program block, but cannot be mixed within a specific declaration. … … 2637 2638 2638 2639 2639 \section{Polymorphi smEvaluation}2640 \section{Polymorphic Evaluation} 2640 2641 \label{sec:eval} 2641 2642
Note: See TracChangeset
for help on using the changeset viewer.