3 ms·
Yes, first-class functions are what I mean. (I come from a lot of C# development, where functions-as-variables are called delegates.) As for sugar, I agree tha
by Total_Meltdown 15y ago
Yes, first-class functions are what I mean. (I come from a lot of C# development, where functions-as-variables are called delegates.)
As for sugar, I agree that it's nice sometimes, but I disagree with extending exception handling specifically. Exceptions are for errors, such as sending data over a closed stream, or indexing an array out of bounds. This "condition system" pattern encourages using exceptions for logic flow. Because why pass a function all the way down the call stack when you can just throw an exception to request that data from higher in the call stack, right?
Exceptions are errors, and they should be treated as such in all cases.
- true_religion 15y ago>Exceptions are errors, and they should be treated as such in all cases. This sounds an awful lot like a semantic argument. If you have resumable exceptions, and can raise an exception deep in the stack to ask higher-stack callers for more information then that's an query. If you raise an exception in non-exceptional circumstances then that's a scoped announcement. The mere fact that in some languages they use the same run-time hooks as exceptions is irrelevant. Exceptions, where I first learned of them in Smalltalk derive from a prototype class that isn't named Exception, and I've seen all manner of uses of the same machinery in stack-twisting. After all once you have full closures, and full control over your stack and context why shouldn't you use it for higher order abstractions involving the stack-context?