Skip to content

Commit c7eccf4

Browse files
Changes to expressions.md (#986)
* 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]>
1 parent 8bb227d commit c7eccf4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/cpp2/expressions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ _ = vec.emplace_back(1,2,3);
3535
}
3636
```
3737

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.
3939

4040

4141
## `is` — safe type/value queries
4242

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.
4444

4545
There are two kinds of `is`:
4646

@@ -60,7 +60,7 @@ There are two kinds of `is`:
6060
| Value | `x is 0` |
6161
| Value predicate | `x is (in(10, 20))` |
6262

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:
6464

6565
- [`mixed-inspect-templates.cpp2`](https://github.com/hsutter/cppfront/tree/main/regression-tests/mixed-inspect-templates.cpp2)
6666
- [`mixed-inspect-values.cpp2`](https://github.com/hsutter/cppfront/tree/main/regression-tests/mixed-inspect-values.cpp2)
@@ -86,7 +86,7 @@ Here are some `is` queries with their Cpp1 equivalents. In this table, uppercase
8686

8787
## `as` — safe casts and conversions
8888

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:
9090

9191
``` cpp title="Using as" hl_lines="4 6 14"
9292
main: () = {

0 commit comments

Comments
 (0)