@evanphx consider using an Error/Exception type. it is nice to be able to unwrap the original reason for emptiness.
-
-
Replying to @halorgium
@halorgium I usually do. But conflating absence with error isn’t great.1 reply 0 retweets 0 likes -
Replying to @halorgium
@halorgium Consider returning data from a service. Many times you want to indicate there was no data separate from a network error.2 replies 0 retweets 0 likes -
Replying to @halorgium
@halorgium@evanphx agreed. There are lots of cases in Rust where a legacy Option<T> should really be a Result<T, E>1 reply 0 retweets 0 likes -
Replying to @wycats
@wycats@halorgium@evanphx Wait, Result<T,E> is a sum type? I don’t Rust (yet).2 replies 0 retweets 0 likes -
Replying to @ReinH
@ReinH@halorgium@evanphx it's an enum: enum Result<T,E> { Ok(T), Err(E) }1 reply 0 retweets 0 likes -
Replying to @wycats
@wycats@halorgium@evanphx It’s just weird to see something that looks like tuple notation (which is a product) used for something sum-like1 reply 0 retweets 0 likes -
Replying to @ReinH
@ReinH@wycats@halorgium@evanphx That syntax was probably inspired by template syntax in C++.2 replies 0 retweets 0 likes
@_mlen @ReinH @halorgium @evanphx and generic syntax in many places :)
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.