3 ms·
This doesn't necessarily seem like functional programming (although there's nothing wrong with functional programming). It makes sense to unify switch and try-c
by trealira 3y ago
This doesn't necessarily seem like functional programming (although there's nothing wrong with functional programming). It makes sense to unify switch and try-catch statements, because they're both meant for selecting a path based on the outcome of the selector expression (as the proposal says). It would make sense for other languages with exceptions, like C++, to adopt something like this, IMO.
> Who knows if this makes it in, next they make exceptions resumable and they go all the way to typed effects.
You don't necessarily need that for resumable exceptions. Common Lisp and PL/I got it a long time ago, although PL/I isn't really in use anymore AFAIK.
Apparently, resumable exceptions used to be more commonly accepted, and then they were rejected in the 1980s[1]:
> Originally, software exception handling included both resumable exceptions (resumption semantics), like most hardware exceptions, and non-resumable exceptions (termination semantics). However, resumption semantics were considered ineffective in practice in the 1970s and 1980s (see C++ standardization discussion, quoted below) and are no longer in common use, though provided by programming languages like Common Lisp, Dylan and PL/I.
I wasn't around then, which is why I say "apparently."
[1]: https://learn.saylor.org/mod/page/view.php?id=33094 https://learn.saylor.org/mod/page/view.php?id=33094