Hacker News new | ask | show | jobs
by ordu 3220 days ago
Doesn't Go have any syntactic sugar for pass errors out of function? Something like Rust's Carrier/From traits and try! or `?`.
2 comments

No, go "errors" are just a convention, there is absolutely nothing special about them.

Go has panic/defer, which are exceptions, but done badly. They were probably retrofitted in the language when its creators realized they needed exceptions anyway, which makes the whole "error as value" a bit hypocritical. If they truly cared about error as value, then yes, Go would support some form of try! macro.

Yes, Rust would be seriously irritating without try! (and its short friend the question mark operator). So I feel the pain of gophers here.
Not really, Go community tends to be very vocal against syntactic sugar.