[OT] - C++ exceptions are becoming more and more problematic

rikki cattermole rikki at cattermole.co.nz
Thu Mar 3 12:19:44 UTC 2022


On 04/03/2022 1:05 AM, Atila Neves wrote:
>> Go, Zig, Rust, and Odin all require explicit checking for error returns.
> 
> Nope: 
> http://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/reference/expressions/operator-expr.html#the-question-mark-operator 
> 
> 
> Years ago, I justified my preference for exceptions because the rest of 
> the call stack didn't have to be cluttered with "rethrowing". Having to 
> pattern match is better, but still a pain. The macro solution they went 
> with is the only one I know of that is as easy to use as exceptions 
> without the associated baggage.

We could do something like this, with both isNull methods and a value 
type exception. We just need this extra form of catch statement.

Could be a pretty good simple addition to whatever DIP is put forward.

```diff
Catch:
+	"catch" NoScopeNonEmptyStatement
```


More information about the Digitalmars-d mailing list