Skip to content

Commit 543633d

Browse files
committed
Fix some documentation bugs, closes #1082
1 parent 5e4fbf3 commit 543633d

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

docs/cpp2/common.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ All lists use `,` commas between list items, and may be enclosed by
6767

6868
For example:
6969

70-
``` cpp title="Lists, using optional trailing commas just because we can" hl_lines="1 4 6 7"
70+
``` cpp title="Lists" hl_lines="1 4 6 7"
7171
print: <T,U> (t: T, u: U) = std::cout << t << u << "\n";
7272

7373
main: () = {

docs/cpp2/expressions.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,11 @@ Here are some `as` casts with their Cpp1 equivalents. In this table, uppercase n
173173

174174
## <a id="inspect"></a> `inspect` — pattern matching
175175

176-
An `inspect expr -> Type` expression allows pattern matching using `is`.
176+
An `inspect expr -> Type = { /* alternatives */ }` expression allows pattern matching using `is`.
177177

178178
- `expr` is evaluated once.
179179

180-
- Each alternative spelled `is C` is evaluated in order as if called with `expr is C`.
181-
182-
- If an alternative evaluates to `#!cpp true`, then its `#!cpp = alternative;` body is used as the value of the entire `inspect` expression, and the meaning is the same as if the entire `inspect` expression had been written as just `#!cpp :Type = alternative;` — i.e., an unnamed object expression (aka 'temporary object') of type `Type` initialized with `alternative`.
180+
- Each alternative is spelled `is C = statement;` and are evaluated in order. Each `is C` is evaluated if called with `expr is C`, and if it alternative evaluates to `#!cpp true`, then its `#!cpp = alternative;` body is used as the value of the entire `inspect` expression, and the meaning is the same as if the entire `inspect` expression had been written as just `#!cpp :Type = alternative;` — i.e., an unnamed object expression (aka 'temporary object') of type `Type` initialized with `alternative`.
183181

184182
- A catchall `is _` is required.
185183

docs/cpp2/types.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ For example:
8181
abstract_base: type
8282
= {
8383
// A pure virtual function: virtual + no body
84-
print: (virtual this, msg: std::string);
84+
print: (virtual this, msg: std::string) = { /*...*/ }
8585

8686
// ...
8787
}
@@ -92,7 +92,7 @@ derived: type
9292
this: abstract_base;
9393

9494
// Explicit override
95-
print: (override this, msg: std::string);
95+
print: (override this, msg: std::string) = { /*...*/ }
9696

9797
// ...
9898
}
@@ -199,7 +199,7 @@ mytype: type
199199
name: std::string;
200200
social_handle: std::string = "(unknown)";
201201

202-
// conversion from string
202+
// conversion from string (construction + assignment)
203203
operator=: (out this, who: std::string) = {
204204
name = who;
205205
// if social_handle is not mentioned, defaults to:

0 commit comments

Comments
 (0)