Hi Michael,

On Mon, Oct 13, 2014 at 8:41 AM, Michael Giagnocavo <m...@giagnocavo.net> wrote:
> I came across the "if let" syntax, and it's been bothering me a bit.
>
> It seems like a strange thing to elevate to a grammar-level construct.
>
> The example given is:
> if let Some(x) = foo() {
>     doSomethingWith(x)
> }
>
> What's wrong with e.g.:
>
> foo().if_some!(|x| { doSomethingWith(x) })?

At least you cant "break" or "return" (from outer function). Also
borrow rules sometimes are more complex when using closure.

--
Paul
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to