News for hackers. Stuff that matters.
Re:Why I Use Elm in 2023 by Buttons840 on Tuesday May 23, 2023 @11:37AM (#36045866)
You absolutely can catch and handle a panic in Rust [0]. Panics are just exceptions by a different name. Although, I do agree that the Rust ecosystem tries hard to avoid using panics, which is good.

[0] Example of catching, handling, and "swallowing" a panic in Rust (GTP4 wrote this): https://play.rust-lang.org/?version=stable&mode=debug&editio...

Re:Why I Use Elm in 2023 by awestroke on Tuesday May 23, 2023 @11:43AM (#36045967)
This is very uncommon to do and cannot be compared to exceptions
Re:Why I Use Elm in 2023 by byby on Tuesday May 23, 2023 @01:14PM (#36047457)
Learned something new. I feel though it's better if most programmers didn't know about this. It looks like cursed knowledge.
Re:Why I Use Elm in 2023 by dmytrish on Thursday May 25, 2023 @06:13AM (#36068880)
It's not exactly cursed knowledge, you just have to have enough judgement to understand where it's appropriate.

Trying to do magic and patch something on a panic and retry is cursed indeed. If it's about cleaning up resources of a thread and logging this somewhere, then there's nothing cursed about this.

Re:Why I Use Elm in 2023 by sriram_malhar on Tuesday May 23, 2023 @01:26PM (#36047652)
Catching a panic is _morally_ equivalent to catching a SIGSEGV. It is not meant for normal program error conditions and expected failures (e.g. "No such file").
Re:Why I Use Elm in 2023 by riwsky on Wednesday May 24, 2023 @02:15AM (#36054699)
I.e. only to be used in exceptional cases.