Hacker News new | past | comments | ask | show | jobs | submit login

FWIW

> Result which is a plain old datatype written in the language, though admittedly it relies on a macro for use

It does not. It relies on a special construct (!) or macro (try!) for convenience, but these are not necessary (a popular alternative is to use the various HoFs instead) and desugar to pretty trivial (if possibly repetitive) code:

    macro_rules! try {
        ($expr:expr) => (match $expr {
            $crate::result::Result::Ok(val) => val,
            $crate::result::Result::Err(err) => {
                return $crate::result::Result::Err($crate::convert::From::from(err))
            }
        })
    }



I don't think Result would be seen as an acceptable replacement for exceptions without the macro/special construct. But I should've been clearer.


(It's ? not !)


(You're right of course, not sure what I was thinking)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: