Skip to content

Commit ee281d7

Browse files
committed
Correct a few more references to try in RFC 243
1 parent d9e79e4 commit ee281d7

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

active/0243-trait-based-exception-handling.md

+13-18
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ Naturally, in this case the types of the "exceptions thrown by" `foo()` and
6161
`bar()` must unify. Like the current `try!()` macro, the `?` operator will also
6262
perform an implicit "upcast" on the exception type.
6363

64-
When used outside of a `try` block, the `?` operator propagates the exception to
64+
When used outside of a `catch` block, the `?` operator propagates the exception to
6565
the caller of the current function, just like the current `try!` macro does. (If
6666
the return type of the function isn't a `Result`, then this is a type error.)
67-
When used inside a `try` block, it propagates the exception up to the innermost
68-
`try` block, as one would expect.
67+
When used inside a `catch` block, it propagates the exception up to the innermost
68+
`catch` block, as one would expect.
6969

7070
Requiring an explicit `?` operator to propagate exceptions strikes a very
7171
pleasing balance between completely automatic exception propagation, which most
@@ -203,7 +203,7 @@ are merely one way.
203203
Err(e) => break 'here Err(e.into())
204204
}
205205

206-
Where `'here` refers to the innermost enclosing `try` block, or to `'fn` if
206+
Where `'here` refers to the innermost enclosing `catch` block, or to `'fn` if
207207
there is none.
208208

209209
The `?` operator has the same precedence as `.`.
@@ -247,21 +247,18 @@ items.
247247

248248
Without any attempt at completeness, here are some things which should be true:
249249

250-
* `try { foo() } ` = `Ok(foo())`
251-
* `try { Err(e)? } ` = `Err(e.into())`
252-
* `try { try_foo()? } ` = `try_foo().map_err(Into::into)`
253-
* `try { Err(e)? } catch { e => e }` = `e.into()`
254-
* `try { Ok(try_foo()?) } catch { e => Err(e) }` = `try_foo().map_err(Into::into)`
250+
* `catch { foo() } ` = `Ok(foo())`
251+
* `catch { Err(e)? } ` = `Err(e.into())`
252+
* `catch { try_foo()? } ` = `try_foo().map_err(Into::into)`
255253

256254
(In the above, `foo()` is a function returning any type, and `try_foo()` is a
257255
function returning a `Result`.)
258256

259257
## Feature gates
260258

261-
The two major features here, the `?` syntax and the `try`/`catch`
262-
syntax, will be tracked by independent feature gates. Each of the
263-
features has a distinct motivation, and we should evaluate them
264-
independently.
259+
The two major features here, the `?` syntax and `catch` expressions,
260+
will be tracked by independent feature gates. Each of the features has
261+
a distinct motivation, and we should evaluate them independently.
265262

266263
# Unresolved questions
267264

@@ -435,11 +432,9 @@ standard monadic bind to accommodate rich control flow like `break`,
435432

436433
* Don't.
437434

438-
* Only add the `?` operator, but not `try` and `try`..`catch`.
435+
* Only add the `?` operator, but not `catch` expressions.
439436

440-
* Only add `?` and `try`, but not `try`..`catch`.
441-
442-
* Instead of a built-in `try`..`catch` construct, attempt to define one using
437+
* Instead of a built-in `catch` construct, attempt to define one using
443438
macros. However, this is likely to be awkward because, at least, macros may
444439
only have their contents as a single block, rather than two. Furthermore,
445440
macros are excellent as a "safety net" for features which we forget to add
@@ -477,7 +472,7 @@ It is possible to carry the exception handling analogy further and also add
477472

478473
`throw` is very simple: `throw EXPR` is essentially the same thing as
479474
`Err(EXPR)?`; in other words it throws the exception `EXPR` to the innermost
480-
`try` block, or to the function's caller if there is none.
475+
`catch` block, or to the function's caller if there is none.
481476

482477
A `throws` clause on a function:
483478

0 commit comments

Comments
 (0)