|
@@ -75,20 +75,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
## Overview
|
|
## Overview
|
|
|
|
|
|
|
|
This documentation describes the design of the Carbon language, and the
|
|
This documentation describes the design of the Carbon language, and the
|
|
|
-rationale for that design. The goal is to provide sufficient coverage of the
|
|
|
|
|
-design to support the following audiences:
|
|
|
|
|
-
|
|
|
|
|
-- People who wish to determine whether Carbon would be the right choice to use
|
|
|
|
|
- for a project compared to other existing languages.
|
|
|
|
|
-- People working on the evolution of the Carbon language who wish to
|
|
|
|
|
- understanding the rationale and motivation for existing design decisions.
|
|
|
|
|
-- People working on a specification or implementation of the Carbon language
|
|
|
|
|
- who need a detailed understanding of the intended design.
|
|
|
|
|
-- People writing Carbon code who wish to understand why the language rules are
|
|
|
|
|
- the way they are.
|
|
|
|
|
-
|
|
|
|
|
-For Carbon developers, documentation that is more suitable for learning the
|
|
|
|
|
-language will be made available separately.
|
|
|
|
|
|
|
+rationale for that design.
|
|
|
|
|
|
|
|
## Context and disclaimer
|
|
## Context and disclaimer
|
|
|
|
|
|
|
@@ -122,10 +109,8 @@ themselves) is also important. It is both an important signal but also a bias.
|
|
|
|
|
|
|
|
### Example code
|
|
### Example code
|
|
|
|
|
|
|
|
-In order to keep example code consistent, we are making choices that may change
|
|
|
|
|
-later. In particular, where `$` is shown in examples, it is a placeholder: `$`
|
|
|
|
|
-is a well-known bad symbol due to international keyboard layouts, and will be
|
|
|
|
|
-cleaned up during evolution.
|
|
|
|
|
|
|
+Some syntax used in example code is provisional or placeholder, and may change
|
|
|
|
|
+later.
|
|
|
|
|
|
|
|
## Basic syntax
|
|
## Basic syntax
|
|
|
|
|
|
|
@@ -837,7 +822,7 @@ be used to instantiate the parameterized definition with the provided arguments
|
|
|
in order to produce a complete type. For example:
|
|
in order to produce a complete type. For example:
|
|
|
|
|
|
|
|
```carbon
|
|
```carbon
|
|
|
-class Stack(T:$$ Type) {
|
|
|
|
|
|
|
+class Stack(template T:! Type) {
|
|
|
var storage: Array(T);
|
|
var storage: Array(T);
|
|
|
|
|
|
|
|
fn Push(value: T);
|
|
fn Push(value: T);
|
|
@@ -867,7 +852,7 @@ arguments. The runtime call then passes the remaining arguments to the resulting
|
|
|
complete definition.
|
|
complete definition.
|
|
|
|
|
|
|
|
```carbon
|
|
```carbon
|
|
|
-fn Convert[T:$$ Type](source: T, U:$$ Type) -> U {
|
|
|
|
|
|
|
+fn Convert[template T:! Type](source: T, template U:! Type) -> U {
|
|
|
var converted: U = source;
|
|
var converted: U = source;
|
|
|
return converted;
|
|
return converted;
|
|
|
}
|
|
}
|