-
From the comments on side discussions and from the status of the current implementation, it seems that Hylo is heading to the path of having a proper exception support with throws() semantics and stack unrolling for error report. I am wondering about the motivations behind this choice considering that many 'new generation' programming languages (Rust, Golang, Odin, Zig) seems to have ditch exceptions for a panic/recover mechanism + algebraic datatypes ( std::Result ). This topic is generally a bit controversial but from my experiences in large scientific codebases and in the embedded system world, I have a mixed feeling about exceptions. On the negative side:
On the positive side:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
This is the only thing I can interpret as a question above:
I'll try to respond to that; to the rest, I mostly can only say, "noted!" Exceptions improve a large category of relatively high-level code that would otherwise include a lot of "check the result to see if it's an error (or a concurrent task cancellation) and if so return it; otherwise unwrap it and continue" boilerplate. Hylo is not trying to be an exclusively-low-level programming language, and that higher-level code is much worse and harder to reason about with the boilerplate included. Also, by distinguishing errors (i.e. postcondition failures) in the language we can improve correctness by making any partially-mutated (and thus meaningless) values inacceessible to the programmer. Re: “new class of problems:” there's no interaction with Hylo's destructive move semantics, or with Hylo's destructors which are statically-checked to be nonthrowing. There's no explosion of branching compared to the equivalent boilerplate that exceptions eliminate. Either your code needs that execution pattern or it doesn't; the branching is the same. If the concern is merely about visibility of the branches, tooling can help. In day-to-day programming seeing the branches all the time gets in the way and makes it easier to create bugs. The safety-critical programming community is important but small; I'm willing to tell them to use tools to do their validation if it means general coding is better/easier. |
Beta Was this translation helpful? Give feedback.
-
Will Hylo's implementation require a runtime? |
Beta Was this translation helpful? Give feedback.
-
Changed the discussion as Q/A and marked as answered to keep the discussion visible for curious minds :) . |
Beta Was this translation helpful? Give feedback.
This is the only thing I can interpret as a question above:
I'll try to respond to that; to the rest, I mostly can only say, "noted!"
Exceptions improve a large category of relatively high-level code that would otherwise include a lot of "check the result to see if it's an error (or a concurrent task cancellation) and if so return it; otherwise unwrap it and continue" boilerplate. Hylo is not trying to be an exclusively-low-level programming language, and that higher-level code is much worse and harder to reason about with the boilerplate included. Also, by distinguishing errors (i.e. postcondition failures) in the language we can …