an operator for ignoring any exceptions

Tab Atkins Jr. jackalmage at gmail.com
Wed Aug 2 12:06:02 UTC 2017


On Wed, Aug 2, 2017 at 3:45 AM, T.J. Crowder
<tj.crowder at farsightsoftware.com> wrote:
> On Wed, Aug 2, 2017 at 4:58 AM, Sheng TIAN <llltgd at gmail.com> wrote:
>> Is there any proposal for an one unary operator for ignoring any
>> exceptions.
>>
>> (I have not search out any related threads. But it is useful IMO,
>> so I'm wondering if this had been discussed.)
>
> In general, a thorough search before posting is your best course.
>
> To the idea: I join the chorus saying that making it easy to ignore errors
> is generally not a good idea. And reusing `try` for something that
> suppresses exceptions implicitly is separately not a good idea in my view.

Agree. Note that the similar operator (`try!(...)`) in Rust does not
*suppress* errors, but rather just simplifies handling of the error
(in Rust, expressed using a Result object); if an error is returned it
immediately returns from the outer function with the Result object;
otherwise it evaluates to the (unwrapped from the Result object)
success value.  This is closer to the try expression you bring up,
just with some slightly more opinionated handling.

~TJ


More information about the es-discuss mailing list