@@ -478,6 +478,32 @@ However, `trap` is used as an error handler in at least one langauge.
478
478
It also does not have the familiarity that `try` does have and is entirely
479
479
inconsistent wrt. naming in the standard library.
480
480
481
+ ## Alternative: reserving `wrap`
482
+
483
+ 1 . ** Fidelity to the construct's actual behavior:** Somewhat good
484
+ 2 . ** Precedent from existing languages:** None
485
+ 3 . ** Brevity / Length :** 4
486
+ 4 . ** Consistency with the naming of the trait used for `? `:** Inconsistent
487
+ 5 . ** Consistency with related libstd fn conventions:** Inconsistent
488
+ 6 . ** Risk of breakage:** Very low
489
+ - ** Used in std:** [* No * ](https:// doc. rust- lang. org/ nightly/ std/? search= wrap)
490
+ - ** Used as crate?** [* Yes * ](https:// crates. io/ crates/ wrap), no reverse dependencies.
491
+ - ** Usage (sourcegraph):** ** 37 +** regex:
492
+ ```
493
+ repogroup: crates case : yes max : 400
494
+ \ b((let | const | type | )\ s+ wrap\ s+=| (fn| impl| mod | struct| enum| union| trait)\ s+ wrap)\ b
495
+ ```
496
+ 7 . ** Consistency with old learning material:** Untaught
497
+
498
+ ### Review
499
+
500
+ With `wrap { .. }` we can say that it " wraps" the result of the block as a
501
+ `Result ` / `Option `, etc. and it is logically related to `. unwrap() `,
502
+ which is however a partial function, wherefore the connotation might be bad.
503
+
504
+ Also , `wrap` could be considered too generic as with `do` in that it could
505
+ fit for any monad.
506
+
481
507
## Alternative: reserving `result`
482
508
483
509
1 . ** Fidelity to the construct's actual behavior:** Somewhat good
0 commit comments