3 ms·
`throw` is a control flow instruction. Simply using it at all controls flow within your code. Are you suggesting never to use it?
by the_other 5y ago
`throw` is a control flow instruction. Simply using it at all controls flow within your code. Are you suggesting never to use it?
- golergka 5y agoI think that the parent comment means "for control flow unrelated to error conditions".
- smt88 5y agoI am suggesting to use it to throw exceptions. This narrow purpose is subtly hinted at by its name.
- the_other 5y agoI don’t see how it’s hinted in the name. “Throwing an exception” is a phrase from within computing that exists because the feature exists in some languages, not because it came into programming from English. There’s also nothing about “exception” that means “error”. If anything, modelling exceptions as errors is the anti-pattern. If you modelled all exceptions as descriptors, you could save Errors for when something actually goes wrong. Honestly though, I’m employing Socratic argument. I am only defending this position to learn about the opposite.