Re:Go proposal: Leave “if err != nil” alone?
by mey on Friday June 28, 2019 @02:24PM
(#20307366)
PHP is a bit of hyperbole, but otherwise correct. :) Ruby, Python, Javascript all support exceptions. PHP does support exceptions, but it's core libraries do not use them. Gotta trust PHP to do the worst of both worlds approach. Perl 6 has it but not sure where the world is in the 5 -> 6 migration. I'm not going to count eval(...) as exception handling as a language feature in Perl 5. :)
[ Parent
| on HN ]
Re:Go proposal: Leave “if err != nil” alone?
by chromatic on Friday June 28, 2019 @02:48PM
(#20307621)
I'm not going to count eval(...) as exception handling as a language feature in Perl 5. :)
You should. It's a perfectly valid exception handling mechanism. It's unfortunate that the name "eval" is overloaded for two separate behaviors:
* catch exceptions thrown as strings or objects
* compile and execute code from a string
Other than the name, they're different behaviors.I am not a Perl expert. Only worked on some simple install tools written it a couple years ago. Re-reading docs, eval(...) traps exceptions (die), but requires manual inspection of error state, instead of automatically halting.
It operates more like Go/C/PHP in that regard.