You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update expressions.md
Signed-off-by: Neil Henderson <[email protected]>
* Minor tweak to not lose "dynamic" types
---------
Signed-off-by: Neil Henderson <[email protected]>
Co-authored-by: Herb Sutter <[email protected]>
Copy file name to clipboardExpand all lines: docs/cpp2/expressions.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -35,12 +35,12 @@ _ = vec.emplace_back(1,2,3);
35
35
}
36
36
```
37
37
38
-
For details, see [Design note: Explicit discard](https://github.com/hsutter/cppfront/wiki/Design-note%3A-Explicit-discard). In Cpp2, data is always initialized, data is never silently lost, data flow is always visible. Data is precious, and it's always safe. This feels right and proper to me.
38
+
For details, see [Design note: Explicit discard](https://github.com/hsutter/cppfront/wiki/Design-note%3A-Explicit-discard). In Cpp2, data is always initialized, data is never silently lost, data flow is always visible. Data is precious, and it's always safe.
39
39
40
40
41
41
## `is` — safe type/value queries
42
42
43
-
An `x is C` expression allows safe type and value queries, and evaluates to `true` if `x` matches constraint `C`. It supports both static and dynamic queries, including customization, with support for the standard dynamically typed libraries `std::variant`, `std::optional`, and `std::any` provided in the box.
43
+
An `x is C` expression allows safe type and value queries, and evaluates to `true` if `x` matches constraint `C`. It supports both static and dynamic queries, including customization, with support for standard library dynamic types like `std::variant`, `std::optional`, `std::expected`, and `std::any` provided out of the box.
44
44
45
45
There are two kinds of `is`:
46
46
@@ -60,7 +60,7 @@ There are two kinds of `is`:
60
60
| Value |`x is 0`|
61
61
| Value predicate |`x is (in(10, 20))`|
62
62
63
-
`is` is useful throughout the language, including in `inspect` pattern matching alternatives. `is` is extensible, and works out of the box with `std::variant`, `std::optional`, and `std::any`. For examples, see:
63
+
`is` is useful throughout the language, including in `inspect` pattern matching alternatives. `is` is extensible, and works out of the box with `std::variant`, `std::optional`, `std::expected`, and `std::any`. For examples, see:
@@ -86,7 +86,7 @@ Here are some `is` queries with their Cpp1 equivalents. In this table, uppercase
86
86
87
87
## `as` — safe casts and conversions
88
88
89
-
An `x as T` expression allows safe type casts. `x` must be an object or expression, and `T` must be a type. It supports both static and dynamic typing, including customization with support for the standard dynamically typed libraries `std::variant`, `std::optional`, and `std::any` provided in the box. For example:
89
+
An `x as T` expression allows safe type casts. `x` must be an object or expression, and `T` must be a type. Like `is`, `as`supports both static and dynamic typing, including customization, with support for standard library dynamic types like `std::variant`, `std::optional`, `std::expected`, and `std::any` provided out of the box. For example:
0 commit comments