3 ms·
You could imagine a language which discourages bubbling exceptions by forcing you to catch and either handle or rethrow each possible exception -- while still m
by amenghra 3y ago
You could imagine a language which discourages bubbling exceptions by forcing you to catch and either handle or rethrow each possible exception -- while still making it hard to accidentally forget to handle an exception.
- jacobr1 3y agoCertainly, and go already comes pretty close that explicitness via returned errors. At that point, we are down to a style choice between exceptions and error returns. Honestly I'm not sure it matters and depends upon other factors being balanced in the ergonomics of the language. I don't see any reason why you couldn't accomplish the objective in either style of language. My point is that Go today, both as matter of language features and how it tends to be used via communal norms, incentivizes explicit error handling. The parent comment stated, "You are less likely to silently/accidentally drop an exception vs Go's tuple return values" and while I could easily imagine language features that discourage bubbling exceptions ... in practice, I think that tends to be more the norm than explicit handling of tuple returns.
- jcranmer 3y agoThat's Java's checked exceptions...