3 ms·
> The author (and pretty much everyone else who never used Visual Basic) misunderstands how it's used. The next line is expected to check the Err object to see
by msbarnett 5y ago
> The author (and pretty much everyone else who never used Visual Basic) misunderstands how it's used. The next line is expected to check the Err object to see if there was an error. It was never expected to be used for just ignoring errors; it's a way to switch from "exception style" to "error code style" error handling.
I think this comes down to how you think about languages and features. Is a feature good if its intended use is that it be used carefully in limited circumstances and with careful error checking?
Or is it a terrible feature if in practice, the largely low-skill userbase slapped it everywhere and anywhere they could with absolute abandon, because it made the confusing error messages go away?
I think the author (and I) just fall in the latter camp. It doesn’t really matter that you weren’t “supposed” to use on error resume next except in limited scopes, and you were “supposed” to rigorously check the Err global afterwards.
In practice, it was abused non-stop as a crutch by people who largely didn’t know what they were doing, and it made touching a VB6 codebase hell on earth.
I’m not looking at the language in the abstract, but from the experience of having been handed maintainership of a few LOB VB6 apps early in my career. On error resume next’s consequences, how people actually used and abused it, are what matter, not whatever hypothetical nice way to use it existed in the docs and the maybe 1 in 50 VB programmers who approached the language with any knowledge or care.
It was a godawful feature that vanishingly few VB programmers ever used correctly, and it made working with VB projects an absolute nightmare.
- electroly 5y agoSure, that was a longwinded way of agreeing with me that it's a footgun. I have similar experience maintaining VB6 apps. This is still how errors are handled in C and Go to this day, and it's error-prone in both languages. Exceptions have proven themselves again and again to be less prone to mistakes than manual checking of error codes. I really don't think the author understands this, though; the quote I provided was pretty unequivocal. The author makes it pretty clear that he doesn't think there's any other way of using the feature. If he does, he made absolutely no mention of it. It's pretty misleading.