On 12/07/2018 03:28 AM, Kenneth Lundin wrote:
It is perfectly possible to use throw and try catch to replace or simplify deeply-nested case ... end expressions in the same way as the proposed language extension does.
Throwing an exception is possible in a pure function, but catching a thrown exception makes the function impure. Advocating the use of exceptions for control-flow of a function in a way that suggests it is the best approach within the programming language is very disturbing. We should be able to encourage functions to be pure, and the OTP behaviours are already a good approach at hiding the impure receive expression and turning it into a function clause match.
A language like Haskell would never suggest the control-flow be best handled with an exception, but the impurity of catching an exception is much clearer in Haskell. Please reconsider how exceptions are not the best solution to this problem when trying to create pure functions whenever possible. The motivation for caring about pure functions is to make the source code easier to test in a reliable way, as the source code changes. It should be easy to see how this motivation, to write better source code is related to writing pure functions when it is possible to do so.
Best Regards, Michael _______________________________________________ eeps mailing list [email protected] http://erlang.org/mailman/listinfo/eeps
