Hacker News new | past | comments | ask | show | jobs | submit login
Exception Handling Considered Harmful (lighterra.com)
1 point by goranmoomin on Nov 22, 2019 | hide | past | favorite | 1 comment



So wrong.

Back in the bad old days I would see code written in C that had three problems with return codes:

1) No error handling or incorrect error handling

2) Use of global variables (!) to pass back return codes from the standard library

3) Correct error handling code might bulk up the code two to three times and make it much harder to understand normal execution never mind error cases.

Now C++ exceptions were a disaster and the trauma caused a generation of coders to hate exceptions.

The current fad for returning an Either object is better organized than what people did in the C days, but it "kicks the can down the road" when it comes to error handling. I have seen my share of Scala apps that use Either and frequently people don't do the right thing about it.

There probably room for something better than Exceptions, but in the next few years people who thought Either was the bee's knees will rediscover Exceptions and it will seem like a breath of fresh air.




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

Search: