logoalt Hacker News

koakuma-chanlast Friday at 8:31 PM6 repliesview on HN

I have one better: the try block pattern.

https://doc.rust-lang.org/beta/unstable-book/language-featur...


Replies

loegyesterday at 1:02 AM

Can this just be done as a lambda that is immediately evaluated? It's just much more verbose.

    let x = (|| -> Result<i32, std::num::ParseIntError> {
         Ok("1".parse::<i32>()?
          + "2".parse::<i32>()?
          + "3".parse::<i32>()?)
    })();
show 3 replies
Syttenlast Friday at 10:09 PM

I want that stabilized so bad but it's not been really moving forward.

show 4 replies
valcron1000yesterday at 12:47 AM

One of the first things I tried in Rust a couple of years ago coming from Haskell. Unfortunately it's still not stabilized :(

tayo42last Friday at 10:51 PM

Why does this need special syntax? Couldn't blocks do this if the expression returns a result in the end?

show 4 replies
onionylast Friday at 9:09 PM

Now that is pretty cool.

satvikpendemyesterday at 9:07 AM

Ah yes, do-notation.