Skip to content

Commit a12bad6

Browse files
committed
minor verbiage
1 parent 1a50c01 commit a12bad6

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

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

+16-17
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ programs is entirely unaffected.
4141

4242
The most important additions are a postfix `?` operator for propagating
4343
"exceptions" and a `try`..`catch` block for catching and handling them. By an
44-
"exception", we essentially just mean the `Err` variant of a `Result`. (See the
45-
"Detailed design" section for more precision.)
44+
"exception", for now, we essentially just mean the `Err` variant of a `Result`.
4645

4746

4847
## `?` operator
@@ -106,7 +105,7 @@ error types which may be propagated:
106105
Here `io::Error` and `json::Error` can be thought of as subtypes of `MyError`,
107106
with a clear and direct embedding into the supertype.
108107

109-
The `?` operator should therefore perform such an implicit conversion in the
108+
The `?` operator should therefore perform such an implicit conversion, in the
110109
nature of a subtype-to-supertype coercion. The present RFC uses the
111110
`std::convert::Into` trait for this purpose (which has a blanket `impl`
112111
forwarding from `From`). The precise requirements for a conversion to be "like"
@@ -150,8 +149,8 @@ There are two variations on this theme:
150149
}
151150

152151
Here the `catch` performs a `match` on the caught exception directly, using
153-
any number of refutable patterns. This form is convenient for checking and
154-
handling the caught exception directly.
152+
any number of refutable patterns. This form is convenient for handling the
153+
exception in-place.
155154

156155

157156
# Detailed design
@@ -274,12 +273,12 @@ are merely one way.
274273

275274
Deep:
276275

277-
match 'here: {
276+
match ('here: {
278277
Ok(match foo() {
279278
Ok(a) => a,
280279
Err(e) => break 'here Err(e.into())
281280
}.bar())
282-
} {
281+
}) {
283282
Ok(a) => a,
284283
Err(e) => match e {
285284
A(a) => baz(a),
@@ -342,7 +341,7 @@ Among the considerations:
342341
* Simplicity. Brevity.
343342

344343
* Following precedent from existing, popular languages, and familiarity with
345-
respect to analogous constructs in them.
344+
respect to their analogous constructs.
346345

347346
* Fidelity to the constructs' actual behavior. For instance, the first clause
348347
always catches the "exception"; the second only branches on it.
@@ -370,7 +369,7 @@ Two obvious, minimal requirements are:
370369
The other requirements for an implicit conversion to be well-behaved in the
371370
context of this feature should be thought through with care.
372371

373-
Some further thoughts and possibilities on this matter:
372+
Some further thoughts and possibilities on this matter, only as brainstorming:
374373

375374
* It should be "like a coercion from subtype to supertype", as described
376375
earlier. The precise meaning of this is not obvious.
@@ -379,20 +378,20 @@ Some further thoughts and possibilities on this matter:
379378
compound-coerce to go from `A` to `Z` indirectly along multiple different
380379
paths, they should all have the same end result.
381380

382-
* It should be unambiguous, or preserve the meaning of the input:
383-
`impl From<u8> for u32` as `x as u32` feels right; as `(x as u32) * 12345`
384-
feels wrong, even though this is perfectly pure, total, and injective. What
385-
this means precisely in the general case is unclear.
386-
387381
* It should be lossless, or in other words, injective: it should map each
388382
observably-different element of the input type to observably-different
389383
elements of the output type. (Observably-different means that it is possible
390384
to write a program which behaves differently depending on which one it gets,
391385
modulo things that "shouldn't count" like observing execution time or
392386
resource usage.)
393387

388+
* It should be unambiguous, or preserve the meaning of the input:
389+
`impl From<u8> for u32` as `x as u32` feels right; as `(x as u32) * 12345`
390+
feels wrong, even though this is perfectly pure, total, and injective. What
391+
this means precisely in the general case is unclear.
392+
394393
* The types converted between should the "same kind of thing": for instance,
395-
the *existing* `impl From<u32> for Ipv4Addr` is pretty suspect on this count.
394+
the *existing* `impl From<u32> for Ipv4Addr` feels suspect on this count.
396395
(This perhaps ties into the subtyping angle: `Ipv4Addr` is clearly not a
397396
supertype of `u32`.)
398397

@@ -566,8 +565,8 @@ below.)
566565
The `translate` method says that it should be possible to translate to any
567566
*other* `ResultCarrier` type which has the same `Normal` and `Exception` types.
568567
This may not appear to be very useful, but in fact, this is what can be used to
569-
inspect the result, by translating it to a concrete type such as `Result<Normal,
570-
Exception>` and then, for example, pattern matching on it.
568+
inspect the result, by translating it to a concrete, known type such as
569+
`Result<Normal, Exception>` and then, for example, pattern matching on it.
571570

572571
Laws:
573572

0 commit comments

Comments
 (0)