# Half-baked idea: postfix/monadic \`unsafe\`

**URL:** <https://internals.rust-lang.org/t/half-baked-idea-postfix-monadic-unsafe/10186>\
**Category:** language design\
**Created:** [May 15, 2019, 8:50pm UTC](https://internals.rust-lang.org/t/half-baked-idea-postfix-monadic-unsafe/10186 "2019-05-15T20:50:12Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![scottmcm](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/scottmcm/32/2355_2.png) [@scottmcm](https://internals.rust-lang.org/u/scottmcm)\
**Post date:** [May 16, 2019, 7:48pm UTC](https://internals.rust-lang.org/t/half-baked-idea-postfix-monadic-unsafe/10186/11 "2019-05-16T19:48:21Z")

</div>

> [@BatmanAoD](#):
>
> to explore why `.await` seems good but `.do_unsafe` doesn’t

Two things come to mind for that:

1. Because it's affecting a block, not a value. This is the same way that it's `async { ... }`, not `{ ... }.async` -- it's telling you context you need to understand the block. Similarly, `{ ... break x ... }.loop` would be surprising because there wasn't the signpost warning you that the `break` was coming the way there is in `loop { ... break x ... }`. (And though I'm probably not in favour of actually _doing_ this for break, note that `loop { ... x.break ... }` doesn't have the same "surprise" factor, the same way that `async { ... x.await ... }` doesn't.)

2. Because async/await is a delayable effect, but unsafe isn't. With async/await, you can call the function to get the `impl Future` _outside_ an `async` block, then _later_ choose whether or not to call `.await` on it. Similarly, you can get your `Result`, put it in a `Vec`, and later decide to `?` on it. On the contrary, `unsafe` needs to be "proven" before the call -- you of course can't call the unsafe function from safe code then later somehow only use the result if it was sound. (`const` also happens like this, where you can't make something `const` later; it has to be `const` from the beginning.)

---

_[View the full topic](https://internals.rust-lang.org/t/half-baked-idea-postfix-monadic-unsafe/10186)._
