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
Copy file name to clipboardExpand all lines: active/0000-trait-based-exception-handling.md
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -132,9 +132,8 @@ constructs, and is independently useful.
132
132
The capability can be exposed either by generalizing `break` to take an optional
133
133
value argument and break out of any block (not just loops), or by generalizing
134
134
`return` to take an optional lifetime argument and return from any block, not
135
-
just the outermost block of the function. This feature is independently useful
136
-
and I believe it should be added, but as it is only used here in this RFC as an
137
-
explanatory device, and implementing the RFC does not require exposing it, I am
135
+
just the outermost block of the function. This feature is only used in this RFC as an
136
+
explanatory device, and implementing the RFC does not require exposing it, so I am
138
137
going to arbitrarily choose the `break` syntax for the following and won't
139
138
discuss the question further.
140
139
@@ -161,6 +160,8 @@ Here if we don't have a thing, we escape from the block early with `None`.
161
160
If no value is specified, it defaults to `()`: in other words, the current behavior.
162
161
We can also imagine there is a magical lifetime `'fn` which refers to the lifetime of the whole function: in this case, `break 'fn` is equivalent to `return`.
163
162
163
+
Again, this RFC does not propose generalizing `break` in this way at this time: it is only used as a way to explain the meaning of the constructs it does propose.
164
+
164
165
165
166
## Definition of constructs
166
167
@@ -318,6 +319,10 @@ Without any attempt at completeness, here are some things which should be true:
318
319
319
320
# Future possibilities
320
321
322
+
## Expose a generalized form of `break` or `return` as described
323
+
324
+
This RFC doesn't propose doing so at this time, but as it would be an independently useful feature, it could be added as well.
325
+
321
326
## An additional `catch` form to bind the caught exception irrefutably
322
327
323
328
The `catch` described above immediately passes the caught exception into a `match` block.
0 commit comments