Skip to content

Commit 63a3c4d

Browse files
committed
I was going to mention "just do it with a macro" in the Alternatives, but it somehow got lost in the shuffle
1 parent c626125 commit 63a3c4d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ Potentially also:
353353
The laws should be sufficient to rule out any "icky" impls. For example, an impl
354354
for `Vec` where an exception is represented as the empty vector, and a normal
355355
result as a single-element vector: here the third law fails, because if the
356-
`Vec` has more than element *to begin with*, then it's not possible to translate
357-
to a different carrier type and then back without losing information.
356+
`Vec` has more than one element *to begin with*, then it's not possible to
357+
translate to a different carrier type and then back without losing information.
358358

359359
The `bool` impl may be surprising, or not useful, but it *is* well-behaved:
360360
`bool` is, after all, isomorphic to `Result<(), ()>`. This `impl` may be
@@ -586,6 +586,15 @@ carrier types, here are some things which should be true:
586586

587587
* Only add the `?` operator, but not any of the other constructs.
588588

589+
* Instead of a built-in `try`..`catch` construct, attempt to define one using
590+
macros. However, this is likely to be awkward because, at least, macros may
591+
only have their contents as a single block, rather than two. Furthermore,
592+
macros are excellent as a "safety net" for features which we forget to add
593+
to the language itself, or which only have specialized use cases; but after
594+
seeing this proposal, we need not forget `try`..`catch`, and its prevalence
595+
in nearly every existing language suggests that it is, in fact, generally
596+
useful.
597+
589598
* Instead of a general `Carrier` trait, define everything directly in terms of
590599
`Result`. This has precedent in that, for example, the `if`..`else` construct
591600
is also defined directly in terms of `bool`. (However, this would likely also

0 commit comments

Comments
 (0)